Version Description
- 19/04/2016 =
- Dev - Fixing plugin's performance issue - Version (
booster_for_woocommerce_version
) parameter added. - Dev -
source
parameter added to documentation link (module and dashboard). - Fix - PRODUCTS - Product Input Fields - File type field - Admin order view (order details) - Check for not empty file name added.
- Dev - PRODUCTS - Product Input Fields - Datepicker/Weekpicker - Year selector and year range options added.
- Dev - PRODUCTS - Product Tabs - Product edit metabox renamed.
- Dev - PRODUCTS - Product Tabs - Per product tabs - Styling (in admin product edit) changed.
- Dev - PRODUCTS - Product Tabs - Per product tabs - Default title/priority/content/conditional visibility by products/categories/tags options added.
- Fix - CART & CHECKOUT - Checkout Files Upload - Fixed wrong "is required" validation when field is disabled.
- Dev - CART & CHECKOUT - Checkout Files Upload - Settings field type changed from
text
totextarea
(in all notice and main label fields). - Dev - CART & CHECKOUT - Checkout Files Upload - Files info added to order details and emails.
- Dev - CART & CHECKOUT - Checkout Files Upload - Conditional visibility by products/categories/tags options added.
- Fix - CART & CHECKOUT - Checkout Custom Fields - Name instead of value in order details and admin order view for select and radio type fields.
- Dev - CART & CHECKOUT - Checkout Custom Fields - Datepicker/Weekpicker - Year selector and year range options added.
- Dev - CART & CHECKOUT - Checkout Custom Fields - Documentation link added.
- Fix - CART & CHECKOUT - Checkout Custom Info - Priority bug fixed.
- Dev - CART & CHECKOUT - Checkout Custom Info - Documentation link added. Reset button added.
- Fix - PAYMENT GATEWAYS - Gateways per Product or Category - Additional check added in
filter_available_payment_gateways_per_category
function. This is fixing compatibility issue with "WooCommerce Subscriptions" plugin. - Dev - PAYMENT GATEWAYS - Gateways per Product or Category - Documentation link added. Reset button added.
- Dev - PDF INVOICING & PACKING SLIPS - Reset buttons added to all submodules.
- Dev - PDF INVOICING & PACKING SLIPS - Documentation link added.
- Dev - PDF INVOICING & PACKING SLIPS - Display & Misc. - "Actions" buttons added (and column buttons removed).
- Dev - PDF INVOICING & PACKING SLIPS - Page Settings - Page Format - Options added.
- Dev - PDF INVOICING & PACKING SLIPS - "Invoices Report" tool - Buttons renamed.
- Dev - EMAILS & MISC. - EU VAT Number - Unnecessary
woocommerce_checkout_update_order_meta
filter function removed. - Dev - EMAILS & MISC. - EU VAT Number - VAT number info added to order details and emails.
- Dev - EMAILS & MISC. - Reports - "Available Reports" section in admin's settings modified.
- Dev - EMAILS & MISC. - Reports - "Booster: Monthly Sales" added.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 2.4.7 |
Comparing to | |
See all releases |
Code changes from version 2.4.6 to 2.4.7
- assets/images/flag-icons/aq.png +0 -0
- includes/admin/class-wc-settings-jetpack.php +4 -3
- includes/class-wcj-checkout-custom-fields.php +88 -26
- includes/class-wcj-checkout-custom-info.php +53 -43
- includes/class-wcj-checkout-files-upload.php +197 -25
- includes/class-wcj-eu-vat-number.php +33 -24
- includes/class-wcj-payment-gateways-per-category.php +9 -4
- includes/class-wcj-pdf-invoicing.php +3 -2
- includes/class-wcj-product-tabs.php +232 -54
- includes/class-wcj-reports.php +86 -17
- includes/classes/class-wcj-module.php +10 -5
- includes/input-fields/class-wcj-product-input-fields-abstract.php +35 -11
- includes/js/wcj-datepicker.js +8 -1
- includes/js/wcj-weekpicker.js +7 -1
- includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php +4 -4
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php +118 -10
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-emails.php +3 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-footer.php +3 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-header.php +3 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-numbering.php +3 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-page.php +366 -8
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-styling.php +3 -3
- includes/pdf-invoices/settings/class-wcj-pdf-invoicing-templates.php +3 -3
- includes/reports/countries/wcj-country-sets.php +8 -4
- includes/reports/wcj-class-reports-monthly-sales.php +224 -0
- readme.txt +32 -3
- woocommerce-jetpack.php +38 -17
assets/images/flag-icons/aq.png
ADDED
Binary file
|
includes/admin/class-wc-settings-jetpack.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Settings class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @since 1.0.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -360,7 +360,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
360 |
/**
|
361 |
* output_dashboard_modules.
|
362 |
*
|
363 |
-
* @version 2.4.
|
364 |
*/
|
365 |
function output_dashboard_modules( $settings, $cat_id = '' ) {
|
366 |
$readme_html = '';
|
@@ -415,7 +415,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
415 |
|
416 |
$html .= '<span class="0"><a href="' . admin_url() . 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=' . $this->get_cat_by_section( $section ) . '§ion=' . $section . '">' . __( 'Settings', 'woocommerce' ) . '</a></span>';
|
417 |
if ( isset( $the_feature['wcj_link'] ) && '' != $the_feature['wcj_link'] ) {
|
418 |
-
$html .= ' | <span class="0"><a href="' . $the_feature['wcj_link'] . '" target="_blank">' . __( 'Documentation', 'woocommerce' ) . '</a></span>';
|
419 |
}
|
420 |
$html .= '</div>';
|
421 |
$html .= '</td>';
|
@@ -431,6 +431,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
|
|
431 |
echo $html;
|
432 |
?></tbody>
|
433 |
</table><p style="color:gray;font-size:x-small;font-style:italic;"><?php echo __( 'Total Modules:' ) . ' ' . $total_modules; ?></p>
|
|
|
434 |
<?php
|
435 |
return $readme_html;
|
436 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Settings class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 1.0.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
360 |
/**
|
361 |
* output_dashboard_modules.
|
362 |
*
|
363 |
+
* @version 2.4.7
|
364 |
*/
|
365 |
function output_dashboard_modules( $settings, $cat_id = '' ) {
|
366 |
$readme_html = '';
|
415 |
|
416 |
$html .= '<span class="0"><a href="' . admin_url() . 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=' . $this->get_cat_by_section( $section ) . '§ion=' . $section . '">' . __( 'Settings', 'woocommerce' ) . '</a></span>';
|
417 |
if ( isset( $the_feature['wcj_link'] ) && '' != $the_feature['wcj_link'] ) {
|
418 |
+
$html .= ' | <span class="0"><a href="' . $the_feature['wcj_link'] . '?source=module_documentation_link" target="_blank">' . __( 'Documentation', 'woocommerce' ) . '</a></span>';
|
419 |
}
|
420 |
$html .= '</div>';
|
421 |
$html .= '</td>';
|
431 |
echo $html;
|
432 |
?></tbody>
|
433 |
</table><p style="color:gray;font-size:x-small;font-style:italic;"><?php echo __( 'Total Modules:' ) . ' ' . $total_modules; ?></p>
|
434 |
+
<p style="text-align:right;color:gray;font-size:x-small;font-style:italic;"><?php echo __( 'Version:' ) . ' ' . get_option( 'booster_for_woocommerce_version', 'N/A' ); ?></p>
|
435 |
<?php
|
436 |
return $readme_html;
|
437 |
}
|
includes/class-wcj-checkout-custom-fields.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Custom Fields class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -17,13 +17,14 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
-
* @version 2.4.
|
21 |
*/
|
22 |
function __construct() {
|
23 |
|
24 |
$this->id = 'checkout_custom_fields';
|
25 |
$this->short_desc = __( 'Checkout Custom Fields', 'woocommerce-jetpack' );
|
26 |
$this->desc = __( 'Add custom fields to WooCommerce checkout page.', 'woocommerce-jetpack' );
|
|
|
27 |
parent::__construct();
|
28 |
|
29 |
if ( $this->is_enabled() ) {
|
@@ -256,7 +257,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
256 |
/**
|
257 |
* update_custom_checkout_fields_order_meta.
|
258 |
*
|
259 |
-
* @version 2.
|
260 |
*/
|
261 |
public function update_custom_checkout_fields_order_meta( $order_id ) {
|
262 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
|
@@ -277,8 +278,13 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
277 |
get_option( 'wcj_checkout_custom_field_checkbox_yes_' . $i ) :
|
278 |
get_option( 'wcj_checkout_custom_field_checkbox_no_' . $i );
|
279 |
update_post_meta( $order_id, '_' . $option_name_checkbox_value, $checkbox_value );
|
|
|
|
|
|
|
|
|
|
|
280 |
} else {
|
281 |
-
update_post_meta( $order_id, '_' . $option_name,
|
282 |
}
|
283 |
}
|
284 |
}
|
@@ -288,7 +294,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
288 |
/**
|
289 |
* add_custom_fields_to_order_display.
|
290 |
*
|
291 |
-
* @version 2.
|
292 |
* @since 2.3.0
|
293 |
*/
|
294 |
function add_custom_fields_to_order_display( $order ) {
|
@@ -300,7 +306,8 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
300 |
if (
|
301 |
false !== strpos( $key, '_label_' ) ||
|
302 |
false !== strpos( $key, '_type_' ) ||
|
303 |
-
false !== strpos( $key, '_checkbox_value_' )
|
|
|
304 |
) {
|
305 |
continue;
|
306 |
}
|
@@ -321,6 +328,25 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
321 |
if ( isset( $post_meta[ $the_type_key ][0] ) && 'checkbox' === $post_meta[ $the_type_key ][0] ) {
|
322 |
$the_checkbox_value_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_checkbox_value_', $key );
|
323 |
$output .= ( isset( $post_meta[ $the_checkbox_value_key ][0] ) ) ? $post_meta[ $the_checkbox_value_key ][0] : $the_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
} else {
|
325 |
$output .= $the_value;
|
326 |
}
|
@@ -333,11 +359,15 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
333 |
/**
|
334 |
* add_woocommerce_admin_fields.
|
335 |
*
|
336 |
-
* @version 2.4.
|
337 |
*/
|
338 |
public function add_woocommerce_admin_fields( $fields, $section ) {
|
339 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
|
340 |
if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
|
|
|
|
|
|
|
|
|
341 |
$the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
|
342 |
/* if ( 'datepicker' === $the_type || 'weekpicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
|
343 |
$the_type = 'text';
|
@@ -347,22 +377,35 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
347 |
} */
|
348 |
if ( 'select' === $the_type ) {
|
349 |
$the_class = 'first';
|
350 |
-
$options
|
351 |
-
}
|
352 |
-
|
353 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
$the_class = 'js_field-country select short';
|
355 |
-
$options
|
356 |
-
}
|
357 |
-
|
358 |
-
$the_type = 'text';
|
359 |
$the_class = 'short';
|
360 |
}
|
361 |
-
$
|
362 |
-
if ( $section != $the_section ) continue;
|
363 |
-
$the_key = 'wcj_checkout_field_' . $i;
|
364 |
$the_key_label = 'wcj_checkout_field_label_' . $i;
|
365 |
-
$the_meta
|
366 |
if ( is_array( $the_meta ) ) {
|
367 |
// Converting from before version 2.3.0
|
368 |
if ( isset( $the_meta['value'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, $the_meta['value'] );
|
@@ -412,7 +455,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
412 |
/**
|
413 |
* add_custom_checkout_fields.
|
414 |
*
|
415 |
-
* @version 2.4.
|
416 |
*/
|
417 |
public function add_custom_checkout_fields( $fields ) {
|
418 |
|
@@ -440,16 +483,20 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
440 |
|
441 |
$the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
|
442 |
$custom_attributes = array();
|
443 |
-
if ( 'datepicker' === $the_type ||
|
444 |
if ( 'datepicker' === $the_type || 'weekpicker' === $the_type ) {
|
445 |
$datepicker_format_option = get_option( 'wcj_checkout_custom_field_datepicker_format_' . $i, '' );
|
446 |
$datepicker_format = ( '' == $datepicker_format_option ) ? get_option( 'date_format' ) : $datepicker_format_option;
|
447 |
$datepicker_format = wcj_date_format_php_to_js_v2( $datepicker_format );
|
448 |
$custom_attributes['dateformat'] = $datepicker_format;
|
449 |
-
$custom_attributes['mindate']
|
450 |
-
$custom_attributes['maxdate']
|
451 |
-
$custom_attributes['firstday']
|
452 |
-
|
|
|
|
|
|
|
|
|
453 |
} elseif ( 'timepicker' === $the_type ) {
|
454 |
$custom_attributes['timeformat'] = get_option( 'wcj_checkout_custom_field_timepicker_format_' . $i, 'hh:mm p' );
|
455 |
$custom_attributes['interval'] = get_option( 'wcj_checkout_custom_field_timepicker_interval_' . $i, 15 );
|
@@ -501,7 +548,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
501 |
/**
|
502 |
* get_settings.
|
503 |
*
|
504 |
-
* @version 2.4.
|
505 |
*/
|
506 |
public function get_settings() {
|
507 |
|
@@ -658,6 +705,21 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
|
|
658 |
'type' => 'number',
|
659 |
'default' => 365,
|
660 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
array(
|
662 |
'title' => '',
|
663 |
'desc' => __( 'If datepicker/weekpicker is selected, set first week day here', 'woocommerce-jetpack' ),
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Custom Fields class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
+
* @version 2.4.7
|
21 |
*/
|
22 |
function __construct() {
|
23 |
|
24 |
$this->id = 'checkout_custom_fields';
|
25 |
$this->short_desc = __( 'Checkout Custom Fields', 'woocommerce-jetpack' );
|
26 |
$this->desc = __( 'Add custom fields to WooCommerce checkout page.', 'woocommerce-jetpack' );
|
27 |
+
$this->link = 'http://booster.io/features/woocommerce-checkout-custom-fields/';
|
28 |
parent::__construct();
|
29 |
|
30 |
if ( $this->is_enabled() ) {
|
257 |
/**
|
258 |
* update_custom_checkout_fields_order_meta.
|
259 |
*
|
260 |
+
* @version 2.4.7
|
261 |
*/
|
262 |
public function update_custom_checkout_fields_order_meta( $order_id ) {
|
263 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
|
278 |
get_option( 'wcj_checkout_custom_field_checkbox_yes_' . $i ) :
|
279 |
get_option( 'wcj_checkout_custom_field_checkbox_no_' . $i );
|
280 |
update_post_meta( $order_id, '_' . $option_name_checkbox_value, $checkbox_value );
|
281 |
+
} elseif ( 'radio' === $the_type || 'select' === $the_type ) {
|
282 |
+
update_post_meta( $order_id, '_' . $option_name, wc_clean( $_POST[ $option_name ] ) );
|
283 |
+
$option_name_values = $the_section . '_' . 'wcj_checkout_field_select_options_' . $i;
|
284 |
+
$the_values = get_option( 'wcj_checkout_custom_field_select_options_' . $i );
|
285 |
+
update_post_meta( $order_id, '_' . $option_name_values, $the_values );
|
286 |
} else {
|
287 |
+
update_post_meta( $order_id, '_' . $option_name, wc_clean( $_POST[ $option_name ] ) );
|
288 |
}
|
289 |
}
|
290 |
}
|
294 |
/**
|
295 |
* add_custom_fields_to_order_display.
|
296 |
*
|
297 |
+
* @version 2.4.7
|
298 |
* @since 2.3.0
|
299 |
*/
|
300 |
function add_custom_fields_to_order_display( $order ) {
|
306 |
if (
|
307 |
false !== strpos( $key, '_label_' ) ||
|
308 |
false !== strpos( $key, '_type_' ) ||
|
309 |
+
false !== strpos( $key, '_checkbox_value_' ) ||
|
310 |
+
false !== strpos( $key, '_select_options_' )
|
311 |
) {
|
312 |
continue;
|
313 |
}
|
328 |
if ( isset( $post_meta[ $the_type_key ][0] ) && 'checkbox' === $post_meta[ $the_type_key ][0] ) {
|
329 |
$the_checkbox_value_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_checkbox_value_', $key );
|
330 |
$output .= ( isset( $post_meta[ $the_checkbox_value_key ][0] ) ) ? $post_meta[ $the_checkbox_value_key ][0] : $the_value;
|
331 |
+
} elseif ( isset( $post_meta[ $the_type_key ][0] ) && ( 'radio' === $post_meta[ $the_type_key ][0] || 'select' === $post_meta[ $the_type_key ][0] ) ) {
|
332 |
+
$the_select_values_key = str_replace( 'wcj_checkout_field_', 'wcj_checkout_field_select_options_', $key );
|
333 |
+
$the_select_values = ( isset( $post_meta[ $the_select_values_key ][0] ) ) ? $post_meta[ $the_select_values_key ][0] : '';
|
334 |
+
if ( ! empty( $the_select_values ) ) {
|
335 |
+
$the_select_values_prepared = wcj_get_select_options( $the_select_values );
|
336 |
+
$is_found = false;
|
337 |
+
foreach ( $the_select_values_prepared as $the_select_value_prepared_key => $the_select_value_prepared_value ) {
|
338 |
+
if ( $the_value === $the_select_value_prepared_key ) {
|
339 |
+
$output .= $the_select_value_prepared_value;
|
340 |
+
$is_found = true;
|
341 |
+
break;
|
342 |
+
}
|
343 |
+
}
|
344 |
+
if ( ! $is_found ) {
|
345 |
+
$output .= $the_value;
|
346 |
+
}
|
347 |
+
} else {
|
348 |
+
$output .= $the_value;
|
349 |
+
}
|
350 |
} else {
|
351 |
$output .= $the_value;
|
352 |
}
|
359 |
/**
|
360 |
* add_woocommerce_admin_fields.
|
361 |
*
|
362 |
+
* @version 2.4.7
|
363 |
*/
|
364 |
public function add_woocommerce_admin_fields( $fields, $section ) {
|
365 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
|
366 |
if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
|
367 |
+
$the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
|
368 |
+
if ( $section != $the_section ) {
|
369 |
+
continue;
|
370 |
+
}
|
371 |
$the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
|
372 |
/* if ( 'datepicker' === $the_type || 'weekpicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
|
373 |
$the_type = 'text';
|
377 |
} */
|
378 |
if ( 'select' === $the_type ) {
|
379 |
$the_class = 'first';
|
380 |
+
$options = wcj_get_select_options( get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
|
381 |
+
} elseif ( 'radio' === $the_type ) {
|
382 |
+
$the_options = get_post_meta( get_the_ID(), '_' . $section . '_' . 'wcj_checkout_field_select_options_' . $i, true );
|
383 |
+
if ( ! empty( $the_options ) ) {
|
384 |
+
$the_type = 'select';
|
385 |
+
$the_class = 'first';
|
386 |
+
$options = wcj_get_select_options( $the_options );
|
387 |
+
} else {
|
388 |
+
$the_options = wcj_get_select_options( get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
|
389 |
+
if ( ! empty( $the_options ) ) {
|
390 |
+
$the_type = 'select';
|
391 |
+
$the_class = 'first';
|
392 |
+
$options = $the_options;
|
393 |
+
} else {
|
394 |
+
$the_type = 'text';
|
395 |
+
$the_class = 'short';
|
396 |
+
}
|
397 |
+
}
|
398 |
+
} elseif ( 'country' === $the_type ) {
|
399 |
+
$the_type = 'select';
|
400 |
$the_class = 'js_field-country select short';
|
401 |
+
$options = WC()->countries->get_allowed_countries();
|
402 |
+
} else /* if ( 'select' != $the_type ) */ {
|
403 |
+
$the_type = 'text';
|
|
|
404 |
$the_class = 'short';
|
405 |
}
|
406 |
+
$the_key = 'wcj_checkout_field_' . $i;
|
|
|
|
|
407 |
$the_key_label = 'wcj_checkout_field_label_' . $i;
|
408 |
+
$the_meta = get_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, true );
|
409 |
if ( is_array( $the_meta ) ) {
|
410 |
// Converting from before version 2.3.0
|
411 |
if ( isset( $the_meta['value'] ) ) update_post_meta( get_the_ID(), '_' . $section . '_' . $the_key, $the_meta['value'] );
|
455 |
/**
|
456 |
* add_custom_checkout_fields.
|
457 |
*
|
458 |
+
* @version 2.4.7
|
459 |
*/
|
460 |
public function add_custom_checkout_fields( $fields ) {
|
461 |
|
483 |
|
484 |
$the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
|
485 |
$custom_attributes = array();
|
486 |
+
if ( 'datepicker' === $the_type || 'weekpicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
|
487 |
if ( 'datepicker' === $the_type || 'weekpicker' === $the_type ) {
|
488 |
$datepicker_format_option = get_option( 'wcj_checkout_custom_field_datepicker_format_' . $i, '' );
|
489 |
$datepicker_format = ( '' == $datepicker_format_option ) ? get_option( 'date_format' ) : $datepicker_format_option;
|
490 |
$datepicker_format = wcj_date_format_php_to_js_v2( $datepicker_format );
|
491 |
$custom_attributes['dateformat'] = $datepicker_format;
|
492 |
+
$custom_attributes['mindate'] = get_option( 'wcj_checkout_custom_field_datepicker_mindate_' . $i, -365 );
|
493 |
+
$custom_attributes['maxdate'] = get_option( 'wcj_checkout_custom_field_datepicker_maxdate_' . $i, 365 );
|
494 |
+
$custom_attributes['firstday'] = get_option( 'wcj_checkout_custom_field_datepicker_firstday_' . $i, 0 );
|
495 |
+
if ( 'yes' === get_option( 'wcj_checkout_custom_field_datepicker_changeyear_' . $i, 'yes' ) ) {
|
496 |
+
$custom_attributes['changeyear'] = 1;
|
497 |
+
$custom_attributes['yearrange'] = get_option( 'wcj_checkout_custom_field_datepicker_yearrange_' . $i, 'c-10:c+10' );
|
498 |
+
}
|
499 |
+
$custom_attributes['display'] = ( 'datepicker' === $the_type ) ? 'date' : 'week';
|
500 |
} elseif ( 'timepicker' === $the_type ) {
|
501 |
$custom_attributes['timeformat'] = get_option( 'wcj_checkout_custom_field_timepicker_format_' . $i, 'hh:mm p' );
|
502 |
$custom_attributes['interval'] = get_option( 'wcj_checkout_custom_field_timepicker_interval_' . $i, 15 );
|
548 |
/**
|
549 |
* get_settings.
|
550 |
*
|
551 |
+
* @version 2.4.7
|
552 |
*/
|
553 |
public function get_settings() {
|
554 |
|
705 |
'type' => 'number',
|
706 |
'default' => 365,
|
707 |
),
|
708 |
+
array(
|
709 |
+
'title' => '',
|
710 |
+
'desc' => __( 'If datepicker/weekpicker is selected, set if you want to add year selector', 'woocommerce-jetpack' ),
|
711 |
+
'id' => 'wcj_checkout_custom_field_datepicker_changeyear_' . $i,
|
712 |
+
'type' => 'checkbox',
|
713 |
+
'default' => 'no',
|
714 |
+
),
|
715 |
+
array(
|
716 |
+
'title' => '',
|
717 |
+
'desc' => __( 'If datepicker/weekpicker is selected, and year selector is enabled, set year range here', 'woocommerce-jetpack' ),
|
718 |
+
'desc_tip' => __( 'The range of years displayed in the year drop-down: either relative to today\'s year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn"). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.', 'woocommerce-jetpack' ),
|
719 |
+
'id' => 'wcj_checkout_custom_field_datepicker_yearrange_' . $i,
|
720 |
+
'type' => 'text',
|
721 |
+
'default' => 'c-10:c+10',
|
722 |
+
),
|
723 |
array(
|
724 |
'title' => '',
|
725 |
'desc' => __( 'If datepicker/weekpicker is selected, set first week day here', 'woocommerce-jetpack' ),
|
includes/class-wcj-checkout-custom-info.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Custom Info class.
|
6 |
*
|
7 |
-
* @version 2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -17,56 +17,80 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
|
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
|
|
|
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
|
23 |
$this->id = 'checkout_custom_info';
|
24 |
$this->short_desc = __( 'Checkout Custom Info', 'woocommerce-jetpack' );
|
25 |
$this->desc = __( 'Add custom info to WooCommerce checkout page.', 'woocommerce-jetpack' );
|
|
|
26 |
parent::__construct();
|
27 |
|
28 |
-
|
29 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) ); $i++) {
|
30 |
add_action(
|
31 |
get_option( 'wcj_checkout_custom_info_hook_' . $i, 'woocommerce_checkout_after_order_review' ),
|
32 |
-
array( $this, 'add_checkout_custom_info' )
|
|
|
33 |
);
|
34 |
}
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* get_settings.
|
|
|
|
|
40 |
*/
|
41 |
function get_settings() {
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$settings[] = array( 'title' => __( 'Checkout Custom Info Blocks', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_checkout_custom_info_blocks_options' );
|
49 |
-
|
50 |
$settings[] = array(
|
51 |
'title' => __( 'Total Blocks', 'woocommerce-jetpack' ),
|
52 |
'id' => 'wcj_checkout_custom_info_total_number',
|
53 |
'default' => 1,
|
54 |
'type' => 'custom_number',
|
55 |
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
56 |
-
'custom_attributes'
|
57 |
-
|
|
|
|
|
|
|
58 |
);
|
59 |
-
|
60 |
-
$settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_checkout_custom_info_blocks_options' );
|
61 |
-
|
62 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
|
63 |
-
|
64 |
for ( $i = 1; $i <= $total_number; $i++) {
|
65 |
-
|
66 |
$settings = array_merge( $settings, array(
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
array(
|
71 |
'title' => __( 'Content', 'woocommerce-jetpack' ),
|
72 |
'id' => 'wcj_checkout_custom_info_content_' . $i,
|
@@ -74,13 +98,13 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
|
|
74 |
'type' => 'textarea',
|
75 |
'css' => 'width:30%;min-width:300px;height:100px;',
|
76 |
),
|
77 |
-
|
78 |
array(
|
79 |
'title' => __( 'Position', 'woocommerce-jetpack' ),
|
80 |
'id' => 'wcj_checkout_custom_info_hook_' . $i,
|
81 |
'default' => 'woocommerce_checkout_after_order_review',
|
82 |
'type' => 'select',
|
83 |
'options' => array(
|
|
|
84 |
'woocommerce_before_checkout_form' => __( 'Before checkout form', 'woocommerce-jetpack' ),
|
85 |
'woocommerce_checkout_before_customer_details' => __( 'Before customer details', 'woocommerce-jetpack' ),
|
86 |
'woocommerce_checkout_billing' => __( 'Billing', 'woocommerce-jetpack' ),
|
@@ -90,7 +114,6 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
|
|
90 |
'woocommerce_checkout_order_review' => __( 'Order review', 'woocommerce-jetpack' ),
|
91 |
'woocommerce_checkout_after_order_review' => __( 'After order review', 'woocommerce-jetpack' ),
|
92 |
'woocommerce_after_checkout_form' => __( 'After checkout form', 'woocommerce-jetpack' ),
|
93 |
-
|
94 |
/*
|
95 |
'woocommerce_before_checkout_shipping_form' => __( 'woocommerce_before_checkout_shipping_form', 'woocommerce-jetpack' ),
|
96 |
'woocommerce_after_checkout_shipping_form' => __( 'woocommerce_after_checkout_shipping_form', 'woocommerce-jetpack' ),
|
@@ -112,33 +135,20 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
|
|
112 |
),
|
113 |
'css' => 'width:250px;',
|
114 |
),
|
115 |
-
|
116 |
array(
|
117 |
-
'title' => __( 'Order (i.e. Priority)', 'woocommerce-jetpack' ),
|
118 |
'id' => 'wcj_checkout_custom_info_priority_' . $i,
|
119 |
'default' => 10,
|
120 |
'type' => 'number',
|
121 |
'css' => 'width:250px;',
|
122 |
),
|
123 |
-
|
124 |
-
|
|
|
|
|
125 |
) );
|
126 |
}
|
127 |
-
|
128 |
-
return $this->add_enable_module_setting( $settings );
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* add_checkout_custom_info.
|
133 |
-
*/
|
134 |
-
function add_checkout_custom_info() {
|
135 |
-
$current_filter = current_filter();
|
136 |
-
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
|
137 |
-
for ( $i = 1; $i <= $total_number; $i++) {
|
138 |
-
if ( '' != get_option( 'wcj_checkout_custom_info_content_' . $i ) && $current_filter === get_option( 'wcj_checkout_custom_info_hook_' . $i ) ) {
|
139 |
-
echo do_shortcode( get_option( 'wcj_checkout_custom_info_content_' . $i ) );
|
140 |
-
}
|
141 |
-
}
|
142 |
}
|
143 |
}
|
144 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Custom Info class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
20 |
+
*
|
21 |
+
* @version 2.4.7
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
|
25 |
$this->id = 'checkout_custom_info';
|
26 |
$this->short_desc = __( 'Checkout Custom Info', 'woocommerce-jetpack' );
|
27 |
$this->desc = __( 'Add custom info to WooCommerce checkout page.', 'woocommerce-jetpack' );
|
28 |
+
$this->link = 'http://booster.io/features/woocommerce-checkout-custom-info/';
|
29 |
parent::__construct();
|
30 |
|
31 |
+
if ( $this->is_enabled() ) {
|
32 |
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) ); $i++) {
|
33 |
add_action(
|
34 |
get_option( 'wcj_checkout_custom_info_hook_' . $i, 'woocommerce_checkout_after_order_review' ),
|
35 |
+
array( $this, 'add_checkout_custom_info' ),
|
36 |
+
get_option( 'wcj_checkout_custom_info_priority_' . $i, 10 )
|
37 |
);
|
38 |
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* add_checkout_custom_info.
|
44 |
+
*
|
45 |
+
* @version 2.4.7
|
46 |
+
*/
|
47 |
+
function add_checkout_custom_info() {
|
48 |
+
$current_filter = current_filter();
|
49 |
+
$current_filter_priority = wcj_current_filter_priority();
|
50 |
+
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
|
51 |
+
for ( $i = 1; $i <= $total_number; $i++) {
|
52 |
+
if (
|
53 |
+
'' != get_option( 'wcj_checkout_custom_info_content_' . $i ) &&
|
54 |
+
$current_filter === get_option( 'wcj_checkout_custom_info_hook_' . $i ) &&
|
55 |
+
$current_filter_priority == get_option( 'wcj_checkout_custom_info_priority_' . $i, 10 )
|
56 |
+
) {
|
57 |
+
echo do_shortcode( get_option( 'wcj_checkout_custom_info_content_' . $i ) );
|
58 |
+
}
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
* get_settings.
|
64 |
+
*
|
65 |
+
* @version 2.4.7
|
66 |
*/
|
67 |
function get_settings() {
|
68 |
+
$settings = array();
|
69 |
+
$settings[] = array(
|
70 |
+
'title' => __( 'Checkout Custom Info Blocks', 'woocommerce-jetpack' ),
|
71 |
+
'type' => 'title',
|
72 |
+
'id' => 'wcj_checkout_custom_info_blocks_options',
|
73 |
+
);
|
|
|
|
|
74 |
$settings[] = array(
|
75 |
'title' => __( 'Total Blocks', 'woocommerce-jetpack' ),
|
76 |
'id' => 'wcj_checkout_custom_info_total_number',
|
77 |
'default' => 1,
|
78 |
'type' => 'custom_number',
|
79 |
'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
80 |
+
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
81 |
+
);
|
82 |
+
$settings[] = array(
|
83 |
+
'type' => 'sectionend',
|
84 |
+
'id' => 'wcj_checkout_custom_info_blocks_options',
|
85 |
);
|
|
|
|
|
|
|
86 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
|
|
|
87 |
for ( $i = 1; $i <= $total_number; $i++) {
|
|
|
88 |
$settings = array_merge( $settings, array(
|
89 |
+
array(
|
90 |
+
'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
|
91 |
+
'type' => 'title',
|
92 |
+
'id' => 'wcj_checkout_custom_info_options_' . $i,
|
93 |
+
),
|
94 |
array(
|
95 |
'title' => __( 'Content', 'woocommerce-jetpack' ),
|
96 |
'id' => 'wcj_checkout_custom_info_content_' . $i,
|
98 |
'type' => 'textarea',
|
99 |
'css' => 'width:30%;min-width:300px;height:100px;',
|
100 |
),
|
|
|
101 |
array(
|
102 |
'title' => __( 'Position', 'woocommerce-jetpack' ),
|
103 |
'id' => 'wcj_checkout_custom_info_hook_' . $i,
|
104 |
'default' => 'woocommerce_checkout_after_order_review',
|
105 |
'type' => 'select',
|
106 |
'options' => array(
|
107 |
+
|
108 |
'woocommerce_before_checkout_form' => __( 'Before checkout form', 'woocommerce-jetpack' ),
|
109 |
'woocommerce_checkout_before_customer_details' => __( 'Before customer details', 'woocommerce-jetpack' ),
|
110 |
'woocommerce_checkout_billing' => __( 'Billing', 'woocommerce-jetpack' ),
|
114 |
'woocommerce_checkout_order_review' => __( 'Order review', 'woocommerce-jetpack' ),
|
115 |
'woocommerce_checkout_after_order_review' => __( 'After order review', 'woocommerce-jetpack' ),
|
116 |
'woocommerce_after_checkout_form' => __( 'After checkout form', 'woocommerce-jetpack' ),
|
|
|
117 |
/*
|
118 |
'woocommerce_before_checkout_shipping_form' => __( 'woocommerce_before_checkout_shipping_form', 'woocommerce-jetpack' ),
|
119 |
'woocommerce_after_checkout_shipping_form' => __( 'woocommerce_after_checkout_shipping_form', 'woocommerce-jetpack' ),
|
135 |
),
|
136 |
'css' => 'width:250px;',
|
137 |
),
|
|
|
138 |
array(
|
139 |
+
'title' => __( 'Position Order (i.e. Priority)', 'woocommerce-jetpack' ),
|
140 |
'id' => 'wcj_checkout_custom_info_priority_' . $i,
|
141 |
'default' => 10,
|
142 |
'type' => 'number',
|
143 |
'css' => 'width:250px;',
|
144 |
),
|
145 |
+
array(
|
146 |
+
'type' => 'sectionend',
|
147 |
+
'id' => 'wcj_checkout_custom_info_options_' . $i,
|
148 |
+
),
|
149 |
) );
|
150 |
}
|
151 |
+
return $this->add_standard_settings( $settings );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
}
|
154 |
|
includes/class-wcj-checkout-files-upload.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Files Upload class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @since 2.4.5
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -17,6 +17,8 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
|
|
|
|
20 |
*/
|
21 |
function __construct() {
|
22 |
|
@@ -40,30 +42,55 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
40 |
get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 )
|
41 |
);
|
42 |
}
|
43 |
-
add_action( 'woocommerce_checkout_order_processed',
|
44 |
-
add_action( 'woocommerce_after_checkout_validation',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* validate.
|
|
|
|
|
50 |
*/
|
51 |
function validate( $posted ) {
|
52 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
|
53 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
54 |
-
if ( 'yes' === get_option( '
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
}
|
@@ -215,10 +242,74 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
215 |
} */
|
216 |
}
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
/**
|
219 |
* add_files_upload_form_to_checkout_frontend.
|
220 |
*
|
221 |
-
* @version 2.4.
|
222 |
*/
|
223 |
function add_files_upload_form_to_checkout_frontend() {
|
224 |
$html = '';
|
@@ -231,7 +322,8 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
231 |
if (
|
232 |
'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) &&
|
233 |
$current_filter === get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) &&
|
234 |
-
$current_filter_priority == get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 )
|
|
|
235 |
) {
|
236 |
$html .= '<form enctype="multipart/form-data" action="" method="POST">';
|
237 |
$html .= '<table>';
|
@@ -302,9 +394,29 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
302 |
/**
|
303 |
* get_settings.
|
304 |
*
|
305 |
-
* @
|
|
|
306 |
*/
|
307 |
function get_settings() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
$settings = array(
|
309 |
array(
|
310 |
'title' => __( 'Options', 'woocommerce-jetpack' ),
|
@@ -392,7 +504,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
392 |
'desc_tip' => __( 'Leave blank to disable label', 'woocommerce-jetpack' ),
|
393 |
'id' => 'wcj_checkout_files_upload_label_' . $i,
|
394 |
'default' => __( 'Please select file to upload', 'woocommerce-jetpack' ),
|
395 |
-
'type' => '
|
396 |
'css' => 'width:250px;',
|
397 |
),
|
398 |
array(
|
@@ -422,14 +534,14 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
422 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
423 |
'id' => 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
|
424 |
'default' => __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ),
|
425 |
-
'type' => '
|
426 |
'css' => 'width:250px;',
|
427 |
),
|
428 |
array(
|
429 |
'desc' => __( 'Notice: File is required', 'woocommerce-jetpack' ),
|
430 |
'id' => 'wcj_checkout_files_upload_notice_required_' . $i,
|
431 |
'default' => __( 'File is required!', 'woocommerce-jetpack' ),
|
432 |
-
'type' => '
|
433 |
'css' => 'width:250px;',
|
434 |
),
|
435 |
array(
|
@@ -437,14 +549,14 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
437 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
438 |
'id' => 'wcj_checkout_files_upload_notice_success_upload_' . $i,
|
439 |
'default' => __( 'File "%s" was successfully uploaded.', 'woocommerce-jetpack' ),
|
440 |
-
'type' => '
|
441 |
'css' => 'width:250px;',
|
442 |
),
|
443 |
array(
|
444 |
'desc' => __( 'Notice: No file selected', 'woocommerce-jetpack' ),
|
445 |
'id' => 'wcj_checkout_files_upload_notice_upload_no_file_' . $i,
|
446 |
'default' => __( 'Please select file to upload!', 'woocommerce-jetpack' ),
|
447 |
-
'type' => '
|
448 |
'css' => 'width:250px;',
|
449 |
),
|
450 |
array(
|
@@ -452,9 +564,69 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
|
|
452 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
453 |
'id' => 'wcj_checkout_files_upload_notice_success_remove_' . $i,
|
454 |
'default' => __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ),
|
455 |
-
'type' => '
|
456 |
'css' => 'width:250px;',
|
457 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
) );
|
459 |
}
|
460 |
$settings = array_merge( $settings, array(
|
4 |
*
|
5 |
* The WooCommerce Jetpack Checkout Files Upload class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.4.5
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
17 |
|
18 |
/**
|
19 |
* Constructor.
|
20 |
+
*
|
21 |
+
* @version 2.4.7
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
42 |
get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 )
|
43 |
);
|
44 |
}
|
45 |
+
add_action( 'woocommerce_checkout_order_processed', array( $this, 'add_files_to_order' ), PHP_INT_MAX, 2 );
|
46 |
+
add_action( 'woocommerce_after_checkout_validation', array( $this, 'validate' ) );
|
47 |
+
add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_files_to_order_display' ), PHP_INT_MAX );
|
48 |
+
add_action( 'woocommerce_email_after_order_table', array( $this, 'add_files_to_order_display' ), PHP_INT_MAX );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* add_files_to_order_display.
|
54 |
+
*
|
55 |
+
* @version 2.4.7
|
56 |
+
* @since 2.4.7
|
57 |
+
*/
|
58 |
+
function add_files_to_order_display( $order ) {
|
59 |
+
$order_id = $order->id;
|
60 |
+
$html = '';
|
61 |
+
$total_files = get_post_meta( $order_id, '_' . 'wcj_checkout_files_total_files', true );
|
62 |
+
for ( $i = 1; $i <= $total_files; $i++ ) {
|
63 |
+
$real_file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i, true );
|
64 |
+
if ( '' != $real_file_name ) {
|
65 |
+
$html .= __( 'File', 'woocommerce-jetpack' ) . ': ' . $real_file_name . '<br>';
|
66 |
+
}
|
67 |
}
|
68 |
+
echo $html;
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
* validate.
|
73 |
+
*
|
74 |
+
* @version 2.4.7
|
75 |
*/
|
76 |
function validate( $posted ) {
|
77 |
$total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
|
78 |
for ( $i = 1; $i <= $total_number; $i++ ) {
|
79 |
+
if ( 'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) && $this->is_visible( $i ) ) {
|
80 |
+
if ( 'yes' === get_option( 'wcj_checkout_files_upload_required_' . $i, 'no' ) && ! isset( $_SESSION[ 'wcj_checkout_files_upload_' . $i ] ) ) {
|
81 |
+
// Is required
|
82 |
+
wc_add_notice( get_option( 'wcj_checkout_files_upload_notice_required_' . $i, __( 'File is required!', 'woocommerce-jetpack' ) ), 'error' );
|
83 |
+
}
|
84 |
+
if ( '' != ( $file_accept = get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) ) && isset( $_SESSION[ 'wcj_checkout_files_upload_' . $i ] ) ) {
|
85 |
+
// Validate file type
|
86 |
+
$file_accept = explode( ',', $file_accept );
|
87 |
+
if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
|
88 |
+
$file_name = $_SESSION[ 'wcj_checkout_files_upload_' . $i ]['name'];
|
89 |
+
$file_type = '.' . pathinfo( $file_name, PATHINFO_EXTENSION );
|
90 |
+
if ( ! in_array( $file_type, $file_accept ) ) {
|
91 |
+
wc_add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
|
92 |
+
__( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $file_name ), 'error' );
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
}
|
242 |
} */
|
243 |
}
|
244 |
|
245 |
+
/**
|
246 |
+
* is_visible.
|
247 |
+
*
|
248 |
+
* @version 2.4.7
|
249 |
+
* @since 2.4.7
|
250 |
+
*/
|
251 |
+
function is_visible( $i ) {
|
252 |
+
|
253 |
+
// Include by product id
|
254 |
+
$products_in = get_option( 'wcj_checkout_files_upload_show_products_in_' . $i );
|
255 |
+
// $do_skip_by_products = false;
|
256 |
+
if ( ! empty( $products_in ) ) {
|
257 |
+
$do_skip_by_products = true;
|
258 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
|
259 |
+
if ( in_array( $values['product_id'], $products_in ) ) {
|
260 |
+
$do_skip_by_products = false;
|
261 |
+
break;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
if ( $do_skip_by_products ) return false;
|
265 |
+
}
|
266 |
+
|
267 |
+
// Include by product category
|
268 |
+
$categories_in = get_option( 'wcj_checkout_files_upload_show_cats_in_' . $i );
|
269 |
+
// $do_skip_by_cats = false;
|
270 |
+
if ( ! empty( $categories_in ) ) {
|
271 |
+
$do_skip_by_cats = true;
|
272 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
|
273 |
+
$product_categories = get_the_terms( $values['product_id'], 'product_cat' );
|
274 |
+
if ( empty( $product_categories ) ) continue;
|
275 |
+
foreach( $product_categories as $product_category ) {
|
276 |
+
if ( in_array( $product_category->term_id, $categories_in ) ) {
|
277 |
+
$do_skip_by_cats = false;
|
278 |
+
break;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
if ( ! $do_skip_by_cats ) break;
|
282 |
+
}
|
283 |
+
if ( $do_skip_by_cats ) return false;
|
284 |
+
}
|
285 |
+
|
286 |
+
// Include by product tag
|
287 |
+
$tags_in = get_option( 'wcj_checkout_files_upload_show_tags_in_' . $i );
|
288 |
+
// $do_skip_by_tags = false;
|
289 |
+
if ( ! empty( $tags_in ) ) {
|
290 |
+
$do_skip_by_tags = true;
|
291 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
|
292 |
+
$product_tags = get_the_terms( $values['product_id'], 'product_tag' );
|
293 |
+
if ( empty( $product_tags ) ) continue;
|
294 |
+
foreach( $product_tags as $product_tag ) {
|
295 |
+
if ( in_array( $product_tag->term_id, $tags_in ) ) {
|
296 |
+
$do_skip_by_tags = false;
|
297 |
+
break;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
if ( ! $do_skip_by_tags ) break;
|
301 |
+
}
|
302 |
+
if ( $do_skip_by_tags ) return false;
|
303 |
+
}
|
304 |
+
|
305 |
+
// return ! ( $do_skip_by_products && $do_skip_by_cats && $do_skip_by_tags );
|
306 |
+
return true;
|
307 |
+
}
|
308 |
+
|
309 |
/**
|
310 |
* add_files_upload_form_to_checkout_frontend.
|
311 |
*
|
312 |
+
* @version 2.4.7
|
313 |
*/
|
314 |
function add_files_upload_form_to_checkout_frontend() {
|
315 |
$html = '';
|
322 |
if (
|
323 |
'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) &&
|
324 |
$current_filter === get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) &&
|
325 |
+
$current_filter_priority == get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 ) &&
|
326 |
+
$this->is_visible( $i )
|
327 |
) {
|
328 |
$html .= '<form enctype="multipart/form-data" action="" method="POST">';
|
329 |
$html .= '<table>';
|
394 |
/**
|
395 |
* get_settings.
|
396 |
*
|
397 |
+
* @version 2.4.7
|
398 |
+
* @todo styling options; options to place form on: cart, order review and my account pages.
|
399 |
*/
|
400 |
function get_settings() {
|
401 |
+
|
402 |
+
$product_tags_options = array();
|
403 |
+
$product_tags = get_terms( 'product_tag', 'orderby=name&hide_empty=0' );
|
404 |
+
if ( ! empty( $product_tags ) && ! is_wp_error( $product_tags ) ){
|
405 |
+
foreach ( $product_tags as $product_tag ) {
|
406 |
+
$product_tags_options[ $product_tag->term_id ] = $product_tag->name;
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
$product_cats_options = array();
|
411 |
+
$product_cats = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
|
412 |
+
if ( ! empty( $product_cats ) && ! is_wp_error( $product_cats ) ){
|
413 |
+
foreach ( $product_cats as $product_cat ) {
|
414 |
+
$product_cats_options[ $product_cat->term_id ] = $product_cat->name;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
$products_options = apply_filters( 'wcj_get_products_filter', array() );
|
419 |
+
|
420 |
$settings = array(
|
421 |
array(
|
422 |
'title' => __( 'Options', 'woocommerce-jetpack' ),
|
504 |
'desc_tip' => __( 'Leave blank to disable label', 'woocommerce-jetpack' ),
|
505 |
'id' => 'wcj_checkout_files_upload_label_' . $i,
|
506 |
'default' => __( 'Please select file to upload', 'woocommerce-jetpack' ),
|
507 |
+
'type' => 'textarea',
|
508 |
'css' => 'width:250px;',
|
509 |
),
|
510 |
array(
|
534 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
535 |
'id' => 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
|
536 |
'default' => __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ),
|
537 |
+
'type' => 'textarea',
|
538 |
'css' => 'width:250px;',
|
539 |
),
|
540 |
array(
|
541 |
'desc' => __( 'Notice: File is required', 'woocommerce-jetpack' ),
|
542 |
'id' => 'wcj_checkout_files_upload_notice_required_' . $i,
|
543 |
'default' => __( 'File is required!', 'woocommerce-jetpack' ),
|
544 |
+
'type' => 'textarea',
|
545 |
'css' => 'width:250px;',
|
546 |
),
|
547 |
array(
|
549 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
550 |
'id' => 'wcj_checkout_files_upload_notice_success_upload_' . $i,
|
551 |
'default' => __( 'File "%s" was successfully uploaded.', 'woocommerce-jetpack' ),
|
552 |
+
'type' => 'textarea',
|
553 |
'css' => 'width:250px;',
|
554 |
),
|
555 |
array(
|
556 |
'desc' => __( 'Notice: No file selected', 'woocommerce-jetpack' ),
|
557 |
'id' => 'wcj_checkout_files_upload_notice_upload_no_file_' . $i,
|
558 |
'default' => __( 'Please select file to upload!', 'woocommerce-jetpack' ),
|
559 |
+
'type' => 'textarea',
|
560 |
'css' => 'width:250px;',
|
561 |
),
|
562 |
array(
|
564 |
'desc_tip' => __( '%s will be replaced with file name', 'woocommerce-jetpack' ),
|
565 |
'id' => 'wcj_checkout_files_upload_notice_success_remove_' . $i,
|
566 |
'default' => __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ),
|
567 |
+
'type' => 'textarea',
|
568 |
'css' => 'width:250px;',
|
569 |
),
|
570 |
+
/* array(
|
571 |
+
'title' => '',
|
572 |
+
'desc' => __( 'PRODUCTS to HIDE this field', 'woocommerce-jetpack' ),
|
573 |
+
'desc_tip' => __( 'To hide this field from some products, enter products here.', 'woocommerce-jetpack' ),
|
574 |
+
'id' => 'wcj_checkout_files_upload_hide_in_products_' . $i,
|
575 |
+
'default' => '',
|
576 |
+
'class' => 'chosen_select',
|
577 |
+
'type' => 'multiselect',
|
578 |
+
'options' => $products_options,
|
579 |
+
), */
|
580 |
+
array(
|
581 |
+
'title' => '',
|
582 |
+
'desc' => __( 'PRODUCTS to show this field', 'woocommerce-jetpack' ),
|
583 |
+
'desc_tip' => __( 'To show this field only if at least one selected product is in cart, enter products here. Leave blank to show for all products.', 'woocommerce-jetpack' ),
|
584 |
+
'id' => 'wcj_checkout_files_upload_show_products_in_' . $i,
|
585 |
+
'default' => '',
|
586 |
+
'class' => 'chosen_select',
|
587 |
+
'type' => 'multiselect',
|
588 |
+
'options' => $products_options,
|
589 |
+
),
|
590 |
+
/* array(
|
591 |
+
'title' => '',
|
592 |
+
'desc' => __( 'CATEGORIES to HIDE this field', 'woocommerce-jetpack' ),
|
593 |
+
'desc_tip' => __( 'To hide this field from some categories, enter categories here.', 'woocommerce-jetpack' ),
|
594 |
+
'id' => 'wcj_checkout_files_upload_hide_in_cats_' . $i,
|
595 |
+
'default' => '',
|
596 |
+
'class' => 'chosen_select',
|
597 |
+
'type' => 'multiselect',
|
598 |
+
'options' => $product_cats_options,
|
599 |
+
), */
|
600 |
+
array(
|
601 |
+
'title' => '',
|
602 |
+
'desc' => __( 'CATEGORIES to show this field', 'woocommerce-jetpack' ),
|
603 |
+
'desc_tip' => __( 'To show this field only if at least one product of selected category is in cart, enter categories here. Leave blank to show for all products.', 'woocommerce-jetpack' ),
|
604 |
+
'id' => 'wcj_checkout_files_upload_show_cats_in_' . $i,
|
605 |
+
'default' => '',
|
606 |
+
'class' => 'chosen_select',
|
607 |
+
'type' => 'multiselect',
|
608 |
+
'options' => $product_cats_options,
|
609 |
+
),
|
610 |
+
/* array(
|
611 |
+
'title' => '',
|
612 |
+
'desc' => __( 'TAGS to HIDE this field', 'woocommerce-jetpack' ),
|
613 |
+
'desc_tip' => __( 'To hide this field from some tags, enter tags here.', 'woocommerce-jetpack' ),
|
614 |
+
'id' => 'wcj_checkout_files_upload_hide_in_tags_' . $i,
|
615 |
+
'default' => '',
|
616 |
+
'class' => 'chosen_select',
|
617 |
+
'type' => 'multiselect',
|
618 |
+
'options' => $product_tags_options,
|
619 |
+
), */
|
620 |
+
array(
|
621 |
+
'title' => '',
|
622 |
+
'desc' => __( 'TAGS to show this field', 'woocommerce-jetpack' ),
|
623 |
+
'desc_tip' => __( 'To show this field only if at least one product of selected tag is in cart, enter tags here. Leave blank to show for all products.', 'woocommerce-jetpack' ),
|
624 |
+
'id' => 'wcj_checkout_files_upload_show_tags_in_' . $i,
|
625 |
+
'default' => '',
|
626 |
+
'class' => 'chosen_select',
|
627 |
+
'type' => 'multiselect',
|
628 |
+
'options' => $product_tags_options,
|
629 |
+
),
|
630 |
) );
|
631 |
}
|
632 |
$settings = array_merge( $settings, array(
|
includes/class-wcj-eu-vat-number.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack EU VAT Number class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @since 2.3.9
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -18,7 +18,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
|
|
18 |
/**
|
19 |
* Constructor.
|
20 |
*
|
21 |
-
* @version 2.
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
@@ -38,23 +38,42 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
|
|
38 |
/* if ( ! session_id() ) {
|
39 |
session_start();
|
40 |
} */
|
41 |
-
// add_action( 'init',
|
42 |
-
add_action( 'init',
|
43 |
-
add_filter( 'woocommerce_checkout_fields',
|
44 |
-
add_filter( 'woocommerce_admin_billing_fields',
|
45 |
-
add_action( 'wp_enqueue_scripts',
|
46 |
-
// add_filter( 'woocommerce_form_field_text',
|
47 |
-
add_action( 'init',
|
48 |
-
add_filter( 'woocommerce_matched_rates',
|
49 |
-
add_action( 'woocommerce_after_checkout_validation',
|
50 |
-
|
51 |
-
add_filter( '
|
52 |
-
|
|
|
53 |
|
54 |
$this->eu_countries_vat_rates_tool = include_once( 'tools/class-wcj-eu-countries-vat-rates-tool.php' );
|
55 |
}
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* create_eu_countries_vat_rates_tool.
|
60 |
*
|
@@ -200,16 +219,6 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
|
|
200 |
}
|
201 |
}
|
202 |
|
203 |
-
/**
|
204 |
-
* update_eu_vat_number_checkout_field_order_meta.
|
205 |
-
*/
|
206 |
-
function update_eu_vat_number_checkout_field_order_meta( $order_id ) {
|
207 |
-
$option_name = '_billing_' . $this->id;
|
208 |
-
if ( isset( $_POST[ $option_name ] ) ) {
|
209 |
-
update_post_meta( $order_id, $option_name, wc_clean( $_POST[ $option_name ] ) );
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
/**
|
214 |
* add_billing_eu_vat_number_field_to_admin_order_display.
|
215 |
*/
|
4 |
*
|
5 |
* The WooCommerce Jetpack EU VAT Number class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.3.9
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
18 |
/**
|
19 |
* Constructor.
|
20 |
*
|
21 |
+
* @version 2.4.7
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
38 |
/* if ( ! session_id() ) {
|
39 |
session_start();
|
40 |
} */
|
41 |
+
// add_action( 'init', 'session_start' );
|
42 |
+
add_action( 'init', array( $this, 'start_session' ) );
|
43 |
+
add_filter( 'woocommerce_checkout_fields', array( $this, 'add_eu_vat_number_checkout_field_to_frontend' ), PHP_INT_MAX );
|
44 |
+
add_filter( 'woocommerce_admin_billing_fields', array( $this, 'add_billing_eu_vat_number_field_to_admin_order_display' ), PHP_INT_MAX );
|
45 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
46 |
+
// add_filter( 'woocommerce_form_field_text', array( $this, 'add_eu_vat_verify_button' ), PHP_INT_MAX, 4 );
|
47 |
+
add_action( 'init', array( $this, 'wcj_validate_eu_vat_number' ) );
|
48 |
+
add_filter( 'woocommerce_matched_rates', array( $this, 'maybe_exclude_vat' ), PHP_INT_MAX, 2 );
|
49 |
+
add_action( 'woocommerce_after_checkout_validation', array( $this, 'checkout_validate_vat' ), PHP_INT_MAX );
|
50 |
+
add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_eu_vat_number_customer_meta_field' ) );
|
51 |
+
add_filter( 'default_checkout_billing_eu_vat_number', array( $this, 'add_default_checkout_billing_eu_vat_number' ), PHP_INT_MAX, 2 );
|
52 |
+
add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
|
53 |
+
add_action( 'woocommerce_email_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
|
54 |
|
55 |
$this->eu_countries_vat_rates_tool = include_once( 'tools/class-wcj-eu-countries-vat-rates-tool.php' );
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
/**
|
60 |
+
* add_eu_vat_number_to_order_display.
|
61 |
+
*
|
62 |
+
* @version 2.4.7
|
63 |
+
* @since 2.4.7
|
64 |
+
*/
|
65 |
+
function add_eu_vat_number_to_order_display( $order ) {
|
66 |
+
$order_id = $order->id;
|
67 |
+
$html = '';
|
68 |
+
$option_name = '_billing_' . $this->id;
|
69 |
+
$the_eu_vat_number = get_post_meta( $order_id, $option_name, true );
|
70 |
+
if ( '' != $the_eu_vat_number ) {
|
71 |
+
$the_label = get_option( 'wcj_eu_vat_number_field_label', __( 'EU VAT Number', 'woocommerce-jetpack' ) );
|
72 |
+
$html .= $the_label . ': ' . $the_eu_vat_number . '<br>';
|
73 |
+
}
|
74 |
+
echo $html;
|
75 |
+
}
|
76 |
+
|
77 |
/**
|
78 |
* create_eu_countries_vat_rates_tool.
|
79 |
*
|
219 |
}
|
220 |
}
|
221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
/**
|
223 |
* add_billing_eu_vat_number_field_to_admin_order_display.
|
224 |
*/
|
includes/class-wcj-payment-gateways-per-category.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways per Category class.
|
6 |
*
|
7 |
-
* @version 2.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -18,13 +18,14 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
|
|
18 |
/**
|
19 |
* Constructor.
|
20 |
*
|
21 |
-
* @version 2.
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
25 |
$this->id = 'payment_gateways_per_category';
|
26 |
$this->short_desc = __( 'Gateways per Product or Category', 'woocommerce-jetpack' );
|
27 |
$this->desc = __( 'Show WooCommerce gateway only if there is selected product or product category in cart.', 'woocommerce-jetpack' );
|
|
|
28 |
parent::__construct();
|
29 |
|
30 |
add_filter( 'init', array( $this, 'add_hooks' ) );
|
@@ -37,11 +38,13 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
|
|
37 |
|
38 |
/**
|
39 |
* get_settings.
|
|
|
|
|
40 |
*/
|
41 |
function get_settings() {
|
42 |
$settings = array();
|
43 |
$settings = apply_filters( 'wcj_payment_gateways_per_category_settings', $settings );
|
44 |
-
return $this->
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -54,12 +57,14 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
|
|
54 |
/**
|
55 |
* filter_available_payment_gateways_per_category.
|
56 |
*
|
57 |
-
* @version 2.
|
58 |
*/
|
59 |
function filter_available_payment_gateways_per_category( $available_gateways ) {
|
60 |
|
61 |
// if ( ! is_checkout() ) return $available_gateways;
|
62 |
|
|
|
|
|
63 |
foreach ( $available_gateways as $gateway_id => $gateway ) {
|
64 |
|
65 |
// Including by categories
|
4 |
*
|
5 |
* The WooCommerce Jetpack Payment Gateways per Category class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
18 |
/**
|
19 |
* Constructor.
|
20 |
*
|
21 |
+
* @version 2.4.7
|
22 |
*/
|
23 |
function __construct() {
|
24 |
|
25 |
$this->id = 'payment_gateways_per_category';
|
26 |
$this->short_desc = __( 'Gateways per Product or Category', 'woocommerce-jetpack' );
|
27 |
$this->desc = __( 'Show WooCommerce gateway only if there is selected product or product category in cart.', 'woocommerce-jetpack' );
|
28 |
+
$this->link = 'http://booster.io/features/woocommerce-gateways-per-product-or-category/';
|
29 |
parent::__construct();
|
30 |
|
31 |
add_filter( 'init', array( $this, 'add_hooks' ) );
|
38 |
|
39 |
/**
|
40 |
* get_settings.
|
41 |
+
*
|
42 |
+
* @version 2.4.7
|
43 |
*/
|
44 |
function get_settings() {
|
45 |
$settings = array();
|
46 |
$settings = apply_filters( 'wcj_payment_gateways_per_category_settings', $settings );
|
47 |
+
return $this->add_standard_settings( $settings );
|
48 |
}
|
49 |
|
50 |
/**
|
57 |
/**
|
58 |
* filter_available_payment_gateways_per_category.
|
59 |
*
|
60 |
+
* @version 2.4.7
|
61 |
*/
|
62 |
function filter_available_payment_gateways_per_category( $available_gateways ) {
|
63 |
|
64 |
// if ( ! is_checkout() ) return $available_gateways;
|
65 |
|
66 |
+
if ( ! isset( WC()->cart ) ) return $available_gateways;
|
67 |
+
|
68 |
foreach ( $available_gateways as $gateway_id => $gateway ) {
|
69 |
|
70 |
// Including by categories
|
includes/class-wcj-pdf-invoicing.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -17,7 +17,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
|
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
@@ -25,6 +25,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
|
|
25 |
$this->short_desc = __( 'PDF Invoicing', 'woocommerce-jetpack' );
|
26 |
$this->section_title = __( 'General', 'woocommerce-jetpack' );
|
27 |
$this->desc = __( 'WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
|
|
|
28 |
parent::__construct();
|
29 |
|
30 |
$this->add_tools( array(
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
+
* @version 2.4.7
|
21 |
*/
|
22 |
public function __construct() {
|
23 |
|
25 |
$this->short_desc = __( 'PDF Invoicing', 'woocommerce-jetpack' );
|
26 |
$this->section_title = __( 'General', 'woocommerce-jetpack' );
|
27 |
$this->desc = __( 'WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.', 'woocommerce-jetpack' );
|
28 |
+
$this->link = 'http://booster.io/features/woocommerce-pdf-invoicing-and-packing-slips/';
|
29 |
parent::__construct();
|
30 |
|
31 |
$this->add_tools( array(
|
includes/class-wcj-product-tabs.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Tabs class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -38,7 +38,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
38 |
/**
|
39 |
* Customize the product tabs.
|
40 |
*
|
41 |
-
* @version 2.4.
|
42 |
*/
|
43 |
function customize_product_tabs( $tabs ) {
|
44 |
|
@@ -206,18 +206,22 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
206 |
$total_custom_tabs = 0;
|
207 |
|
208 |
for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
|
209 |
-
$
|
|
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
221 |
}
|
222 |
|
223 |
return $tabs;
|
@@ -241,7 +245,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
241 |
/**
|
242 |
* save_custom_tabs_meta_box.
|
243 |
*
|
244 |
-
* @version 2.
|
245 |
*/
|
246 |
public function save_custom_tabs_meta_box( $post_id, $post ) {
|
247 |
|
@@ -259,8 +263,10 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
259 |
$total_custom_tabs_before_saving = get_post_meta( $post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true );
|
260 |
$total_custom_tabs_before_saving = ( '' != $total_custom_tabs_before_saving ) ? $total_custom_tabs_before_saving : $default_total_custom_tabs;
|
261 |
for ( $i = 1; $i <= $total_custom_tabs_before_saving; $i++ ) {
|
262 |
-
|
263 |
-
|
|
|
|
|
264 |
}
|
265 |
}
|
266 |
|
@@ -273,12 +279,12 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
273 |
/**
|
274 |
* add_custom_tabs_meta_box.
|
275 |
*
|
276 |
-
* @version 2.
|
277 |
*/
|
278 |
public function add_custom_tabs_meta_box() {
|
279 |
add_meta_box(
|
280 |
'wc-jetpack-custom-tabs',
|
281 |
-
__( '
|
282 |
array( $this, 'create_custom_tabs_meta_box' ),
|
283 |
'product',
|
284 |
'normal',
|
@@ -286,10 +292,100 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
286 |
);
|
287 |
}
|
288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
/**
|
290 |
* create_custom_tabs_meta_box.
|
291 |
*
|
292 |
-
* @version 2.
|
293 |
*/
|
294 |
public function create_custom_tabs_meta_box() {
|
295 |
|
@@ -334,28 +430,37 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
334 |
'type' => 'number',
|
335 |
),
|
336 |
);
|
337 |
-
// $html .= '<h4>' . __( 'Customize the tab(s)', 'woocommerce-jetpack' ) . '</h4>';
|
338 |
for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
|
|
|
|
|
|
|
339 |
$data = array();
|
340 |
$html .= '<hr>';
|
341 |
-
$html .= '<h4>' . __( 'Custom Product Tab', 'woocommerce-jetpack' ) . ' #' . $i . '</h4>';
|
342 |
-
|
343 |
-
$
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
-
$data
|
357 |
}
|
358 |
-
$html .= wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
|
359 |
}
|
360 |
$html .= '<input type="hidden" name="woojetpack_custom_tabs_save_post" value="woojetpack_custom_tabs_save_post">';
|
361 |
echo $html;
|
@@ -364,12 +469,11 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
364 |
/**
|
365 |
* get_settings.
|
366 |
*
|
367 |
-
* @version 2.4.
|
368 |
*/
|
369 |
function get_settings() {
|
370 |
|
371 |
$settings = array(
|
372 |
-
|
373 |
// Global Custom Tabs
|
374 |
array(
|
375 |
'title' => __( 'Custom Product Tabs Options', 'woocommerce-jetpack' ),
|
@@ -377,7 +481,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
377 |
'desc' => __( 'This section lets you add custom single product tabs.', 'woocommerce-jetpack' ),
|
378 |
'id' => 'wcj_custom_product_tabs_options',
|
379 |
),
|
380 |
-
|
381 |
array(
|
382 |
'title' => __( 'Custom Product Tabs Number', 'woocommerce-jetpack' ),
|
383 |
'desc_tip' => __( 'Click "Save changes" after you change this number.', 'woocommerce-jetpack' ),
|
@@ -536,12 +639,10 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
536 |
}
|
537 |
|
538 |
$settings = array_merge( $settings, array(
|
539 |
-
|
540 |
array(
|
541 |
'type' => 'sectionend',
|
542 |
'id' => 'wcj_custom_product_tabs_options',
|
543 |
),
|
544 |
-
|
545 |
// Local Custom Tabs
|
546 |
array(
|
547 |
'title' => __( 'Custom Product Tabs - Per Product', 'woocommerce-jetpack' ),
|
@@ -549,7 +650,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
549 |
'desc' => __( 'This section lets you set defaults for per product custom tabs.', 'woocommerce-jetpack' ),
|
550 |
'id' => 'wcj_custom_product_tabs_options_local',
|
551 |
),
|
552 |
-
|
553 |
array(
|
554 |
'title' => __( 'Enable Per Product Custom Product Tabs', 'woocommerce-jetpack' ),
|
555 |
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
@@ -558,7 +658,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
558 |
'default' => 'yes',
|
559 |
'type' => 'checkbox',
|
560 |
),
|
561 |
-
|
562 |
array(
|
563 |
'title' => __( 'Default Per Product Custom Product Tabs Number', 'woocommerce-jetpack' ),
|
564 |
'id' => 'wcj_custom_product_tabs_local_total_number_default',
|
@@ -568,12 +667,102 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
568 |
'custom_attributes'
|
569 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
570 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
|
|
|
572 |
array(
|
573 |
'type' => 'sectionend',
|
574 |
'id' => 'wcj_custom_product_tabs_options_local',
|
575 |
),
|
576 |
-
|
577 |
// Standard WooCommerce Tabs
|
578 |
array(
|
579 |
'title' => __( 'WooCommerce Standard Product Tabs Options', 'woocommerce-jetpack' ),
|
@@ -581,7 +770,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
581 |
'desc' => __( 'This section lets you customize single product tabs.', 'woocommerce-jetpack' ),
|
582 |
'id' => 'wcj_product_info_product_tabs_options',
|
583 |
),
|
584 |
-
|
585 |
array(
|
586 |
'title' => __( 'Description Tab', 'woocommerce-jetpack' ),
|
587 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
@@ -589,7 +777,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
589 |
'default' => 'no',
|
590 |
'type' => 'checkbox',
|
591 |
),
|
592 |
-
|
593 |
array(
|
594 |
'title' => '',
|
595 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
@@ -598,7 +785,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
598 |
'default' => '',
|
599 |
'type' => 'text',
|
600 |
),
|
601 |
-
|
602 |
array(
|
603 |
'title' => '',
|
604 |
'id' => 'wcj_product_info_product_tabs_description_priority',
|
@@ -607,7 +793,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
607 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
608 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
609 |
),
|
610 |
-
|
611 |
array(
|
612 |
'title' => __( 'Additional Information Tab', 'woocommerce-jetpack' ),
|
613 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
@@ -615,7 +800,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
615 |
'default' => 'no',
|
616 |
'type' => 'checkbox',
|
617 |
),
|
618 |
-
|
619 |
array(
|
620 |
'title' => '',
|
621 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
@@ -624,7 +808,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
624 |
'default' => '',
|
625 |
'type' => 'text',
|
626 |
),
|
627 |
-
|
628 |
array(
|
629 |
'title' => '',
|
630 |
'id' => 'wcj_product_info_product_tabs_additional_information_priority',
|
@@ -633,7 +816,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
633 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
634 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
635 |
),
|
636 |
-
|
637 |
array(
|
638 |
'title' => __( 'Reviews Tab', 'woocommerce-jetpack' ),
|
639 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
@@ -641,7 +823,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
641 |
'default' => 'no',
|
642 |
'type' => 'checkbox',
|
643 |
),
|
644 |
-
|
645 |
array(
|
646 |
'title' => '',
|
647 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
@@ -650,7 +831,6 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
650 |
'default' => '',
|
651 |
'type' => 'text',
|
652 |
),
|
653 |
-
|
654 |
array(
|
655 |
'title' => '',
|
656 |
'id' => 'wcj_product_info_product_tabs_reviews_priority',
|
@@ -659,12 +839,10 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
659 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
660 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
661 |
),
|
662 |
-
|
663 |
array(
|
664 |
'type' => 'sectionend',
|
665 |
'id' => 'wcj_product_info_product_tabs_options',
|
666 |
),
|
667 |
-
|
668 |
) );
|
669 |
|
670 |
return $this->add_standard_settings( $settings );
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Tabs class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
38 |
/**
|
39 |
* Customize the product tabs.
|
40 |
*
|
41 |
+
* @version 2.4.7
|
42 |
*/
|
43 |
function customize_product_tabs( $tabs ) {
|
44 |
|
206 |
$total_custom_tabs = 0;
|
207 |
|
208 |
for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
|
209 |
+
if ( $this->is_local_tab_visible( $i, $current_post_id ) ) {
|
210 |
+
$key = 'local_' . $i;
|
211 |
|
212 |
+
$tab_priority = get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_priority_' . $key, true );
|
213 |
+
if ( ! $tab_priority ) {
|
214 |
+
$tab_priority = (50 + $i - 1);
|
215 |
+
}
|
216 |
|
217 |
+
if ( '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ) && '' != get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_content_' . $key, true ) ) {
|
218 |
+
$tabs[ $key ] = array(
|
219 |
+
'title' => get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_title_' . $key, true ),
|
220 |
+
'priority' => $tab_priority,
|
221 |
+
'callback' => array( $this, 'create_new_custom_product_tab_local' ),
|
222 |
+
);
|
223 |
+
}
|
224 |
+
}
|
225 |
}
|
226 |
|
227 |
return $tabs;
|
245 |
/**
|
246 |
* save_custom_tabs_meta_box.
|
247 |
*
|
248 |
+
* @version 2.4.7
|
249 |
*/
|
250 |
public function save_custom_tabs_meta_box( $post_id, $post ) {
|
251 |
|
263 |
$total_custom_tabs_before_saving = get_post_meta( $post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true );
|
264 |
$total_custom_tabs_before_saving = ( '' != $total_custom_tabs_before_saving ) ? $total_custom_tabs_before_saving : $default_total_custom_tabs;
|
265 |
for ( $i = 1; $i <= $total_custom_tabs_before_saving; $i++ ) {
|
266 |
+
if ( $this->is_local_tab_visible( $i, $post_id ) ) {
|
267 |
+
foreach ( $option_names as $option_name ) {
|
268 |
+
update_post_meta( $post_id, '_' . $option_name . $i, $_POST[ $option_name . $i ] );
|
269 |
+
}
|
270 |
}
|
271 |
}
|
272 |
|
279 |
/**
|
280 |
* add_custom_tabs_meta_box.
|
281 |
*
|
282 |
+
* @version 2.4.7
|
283 |
*/
|
284 |
public function add_custom_tabs_meta_box() {
|
285 |
add_meta_box(
|
286 |
'wc-jetpack-custom-tabs',
|
287 |
+
__( 'Booster: Custom Tabs', 'woocommerce-jetpack' ),
|
288 |
array( $this, 'create_custom_tabs_meta_box' ),
|
289 |
'product',
|
290 |
'normal',
|
292 |
);
|
293 |
}
|
294 |
|
295 |
+
/**
|
296 |
+
* is_local_tab_visible.
|
297 |
+
*
|
298 |
+
* @version 2.4.7
|
299 |
+
* @since 2.4.7
|
300 |
+
*/
|
301 |
+
function is_local_tab_visible( $custom_tab_index, $product_id ) {
|
302 |
+
|
303 |
+
// Exclude by product id
|
304 |
+
$array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_products_' . $custom_tab_index );
|
305 |
+
if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
|
306 |
+
if ( $array_to_exclude && in_array( $product_id, $array_to_exclude ) ) {
|
307 |
+
return false;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
// Exclude by product category
|
312 |
+
$array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_cats_' . $custom_tab_index );
|
313 |
+
if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
|
314 |
+
$product_categories_objects = get_the_terms( $product_id, 'product_cat' );
|
315 |
+
if ( $product_categories_objects && ! empty( $product_categories_objects ) ) {
|
316 |
+
foreach ( $product_categories_objects as $product_categories_object ) {
|
317 |
+
if ( $array_to_exclude && in_array( $product_categories_object->term_id, $array_to_exclude ) ) {
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
// Exclude by product tag
|
325 |
+
$array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_tags_' . $custom_tab_index );
|
326 |
+
if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
|
327 |
+
$product_tags_objects = get_the_terms( $product_id, 'product_tag' );
|
328 |
+
if ( $product_tags_objects && ! empty( $product_tags_objects ) ) {
|
329 |
+
foreach ( $product_tags_objects as $product_tags_object ) {
|
330 |
+
if ( $array_to_exclude && in_array( $product_tags_object->term_id, $array_to_exclude ) ) {
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
// Include by product id
|
338 |
+
$array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_products_' . $custom_tab_index );
|
339 |
+
if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
|
340 |
+
// If NOT in array then hide this tab for this product
|
341 |
+
if ( $array_to_include && ! in_array( $product_id, $array_to_include ) ) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
// Include by product category
|
347 |
+
$array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_cats_' . $custom_tab_index );
|
348 |
+
if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
|
349 |
+
$do_include = false;
|
350 |
+
$product_categories_objects = get_the_terms( $product_id, 'product_cat' );
|
351 |
+
if ( $product_categories_objects && ! empty( $product_categories_objects ) ) {
|
352 |
+
foreach ( $product_categories_objects as $product_categories_object ) {
|
353 |
+
if ( $array_to_include && in_array( $product_categories_object->term_id, $array_to_include ) ) {
|
354 |
+
$do_include = true;
|
355 |
+
break;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
if ( ! $do_include ) {
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
// Include by product tag
|
365 |
+
$array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_tags_' . $custom_tab_index );
|
366 |
+
if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
|
367 |
+
$do_include = false;
|
368 |
+
$product_tags_objects = get_the_terms( $product_id, 'product_tag' );
|
369 |
+
if ( $product_tags_objects && ! empty( $product_tags_objects ) ) {
|
370 |
+
foreach ( $product_tags_objects as $product_tags_object ) {
|
371 |
+
if ( $array_to_include && in_array( $product_tags_object->term_id, $array_to_include ) ) {
|
372 |
+
$do_include = true;
|
373 |
+
break;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
if ( ! $do_include ) {
|
378 |
+
return false;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
return true;
|
383 |
+
}
|
384 |
+
|
385 |
/**
|
386 |
* create_custom_tabs_meta_box.
|
387 |
*
|
388 |
+
* @version 2.4.7
|
389 |
*/
|
390 |
public function create_custom_tabs_meta_box() {
|
391 |
|
430 |
'type' => 'number',
|
431 |
),
|
432 |
);
|
|
|
433 |
for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
|
434 |
+
$is_local_tab_visible = $this->is_local_tab_visible( $i, $current_post_id );
|
435 |
+
$readonly = ( $is_local_tab_visible ) ? '' : ' readonly'; // not really used
|
436 |
+
$disabled = ( $is_local_tab_visible ) ? '' : ' - ' . __( 'Disabled', 'woocommerce-jetpack' );
|
437 |
$data = array();
|
438 |
$html .= '<hr>';
|
439 |
+
$html .= '<h4>' . __( 'Custom Product Tab', 'woocommerce-jetpack' ) . ' #' . $i . $disabled . '</h4>';
|
440 |
+
if ( $is_local_tab_visible ) {
|
441 |
+
foreach ( $options as $option ) {
|
442 |
+
$option_id = $option['id'] . $i;
|
443 |
+
if ( ! ( $option_value = get_post_meta( $current_post_id, '_' . $option_id, true ) ) ) {
|
444 |
+
$option_value = get_option( $option['id'] . 'default_' . $i, '' );
|
445 |
+
if ( '' === $option_value && 'wcj_custom_product_tabs_priority_local_' === $option['id'] ) {
|
446 |
+
$option_value = 50;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
switch ( $option['type'] ) {
|
450 |
+
case 'number':
|
451 |
+
$the_field = '<input style="width:25%;min-width:100px;" type="' . $option['type'] . '" id="' . $option_id . '" name="' . $option_id . '" value="' . $option_value . '"' . $readonly . '>';
|
452 |
+
break;
|
453 |
+
case 'text':
|
454 |
+
$the_field = '<input style="width:50%;min-width:150px;" type="' . $option['type'] . '" id="' . $option_id . '" name="' . $option_id . '" value="' . $option_value . '"' . $readonly . '>';
|
455 |
+
break;
|
456 |
+
case 'textarea':
|
457 |
+
$the_field = '<textarea style="width:100%;height:300px;" id="' . $option_id . '" name="' . $option_id . '"' . $readonly . '>' . $option_value . '</textarea>';
|
458 |
+
break;
|
459 |
+
}
|
460 |
+
$data[] = array( $option['title'], $the_field );
|
461 |
}
|
462 |
+
$html .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', 'table_heading_type' => 'vertical', 'columns_styles' => array( 'width:10%;', ) ) );
|
463 |
}
|
|
|
464 |
}
|
465 |
$html .= '<input type="hidden" name="woojetpack_custom_tabs_save_post" value="woojetpack_custom_tabs_save_post">';
|
466 |
echo $html;
|
469 |
/**
|
470 |
* get_settings.
|
471 |
*
|
472 |
+
* @version 2.4.7
|
473 |
*/
|
474 |
function get_settings() {
|
475 |
|
476 |
$settings = array(
|
|
|
477 |
// Global Custom Tabs
|
478 |
array(
|
479 |
'title' => __( 'Custom Product Tabs Options', 'woocommerce-jetpack' ),
|
481 |
'desc' => __( 'This section lets you add custom single product tabs.', 'woocommerce-jetpack' ),
|
482 |
'id' => 'wcj_custom_product_tabs_options',
|
483 |
),
|
|
|
484 |
array(
|
485 |
'title' => __( 'Custom Product Tabs Number', 'woocommerce-jetpack' ),
|
486 |
'desc_tip' => __( 'Click "Save changes" after you change this number.', 'woocommerce-jetpack' ),
|
639 |
}
|
640 |
|
641 |
$settings = array_merge( $settings, array(
|
|
|
642 |
array(
|
643 |
'type' => 'sectionend',
|
644 |
'id' => 'wcj_custom_product_tabs_options',
|
645 |
),
|
|
|
646 |
// Local Custom Tabs
|
647 |
array(
|
648 |
'title' => __( 'Custom Product Tabs - Per Product', 'woocommerce-jetpack' ),
|
650 |
'desc' => __( 'This section lets you set defaults for per product custom tabs.', 'woocommerce-jetpack' ),
|
651 |
'id' => 'wcj_custom_product_tabs_options_local',
|
652 |
),
|
|
|
653 |
array(
|
654 |
'title' => __( 'Enable Per Product Custom Product Tabs', 'woocommerce-jetpack' ),
|
655 |
'desc' => __( 'Enable', 'woocommerce-jetpack' ),
|
658 |
'default' => 'yes',
|
659 |
'type' => 'checkbox',
|
660 |
),
|
|
|
661 |
array(
|
662 |
'title' => __( 'Default Per Product Custom Product Tabs Number', 'woocommerce-jetpack' ),
|
663 |
'id' => 'wcj_custom_product_tabs_local_total_number_default',
|
667 |
'custom_attributes'
|
668 |
=> apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
669 |
),
|
670 |
+
) );
|
671 |
+
|
672 |
+
for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) ); $i++ ) {
|
673 |
+
$settings = array_merge( $settings, array(
|
674 |
+
array(
|
675 |
+
'title' => __( 'Custom Product Tab', 'woocommerce-jetpack' ) . ' #' . $i,
|
676 |
+
'desc' => __( 'Default Title', 'woocommerce-jetpack' ),
|
677 |
+
'id' => 'wcj_custom_product_tabs_title_local_default_' . $i,
|
678 |
+
'default' => '',
|
679 |
+
'type' => 'text',
|
680 |
+
'css' => 'width:30%;min-width:300px;',
|
681 |
+
),
|
682 |
+
array(
|
683 |
+
'title' => '',
|
684 |
+
'desc' => __( 'Default Priority (i.e. Order)', 'woocommerce-jetpack' ),
|
685 |
+
'id' => 'wcj_custom_product_tabs_priority_local_default_' . $i,
|
686 |
+
'default' => 50,
|
687 |
+
'type' => 'number',
|
688 |
+
),
|
689 |
+
array(
|
690 |
+
'title' => '',
|
691 |
+
'desc' => __( 'Default Content', 'woocommerce-jetpack' ),
|
692 |
+
'desc_tip' => __( 'You can use shortcodes here...', 'woocommerce-jetpack' ),
|
693 |
+
'id' => 'wcj_custom_product_tabs_content_local_default_' . $i,
|
694 |
+
'default' => '',
|
695 |
+
'type' => 'textarea',
|
696 |
+
'css' => 'width:50%;min-width:300px;height:200px;',
|
697 |
+
),
|
698 |
+
array(
|
699 |
+
'title' => '',
|
700 |
+
'desc' => __( 'PRODUCTS to HIDE this tab', 'woocommerce-jetpack' ),
|
701 |
+
'desc_tip' => __( 'To hide this tab from some products, enter products here.', 'woocommerce-jetpack' ),
|
702 |
+
'id' => 'wcj_custom_product_tabs_local_hide_in_products_' . $i,
|
703 |
+
'default' => '',
|
704 |
+
'class' => 'chosen_select',
|
705 |
+
'type' => 'multiselect',
|
706 |
+
'options' => $products_options,
|
707 |
+
),
|
708 |
+
array(
|
709 |
+
'title' => '',
|
710 |
+
'desc' => __( 'PRODUCTS to SHOW this tab', 'woocommerce-jetpack' ),
|
711 |
+
'desc_tip' => __( 'To show this tab only for some products, enter products here.', 'woocommerce-jetpack' ),
|
712 |
+
'id' => 'wcj_custom_product_tabs_local_show_in_products_' . $i,
|
713 |
+
'default' => '',
|
714 |
+
'class' => 'chosen_select',
|
715 |
+
'type' => 'multiselect',
|
716 |
+
'options' => $products_options,
|
717 |
+
),
|
718 |
+
array(
|
719 |
+
'title' => '',
|
720 |
+
'desc' => __( 'CATEGORIES to HIDE this tab', 'woocommerce-jetpack' ),
|
721 |
+
'desc_tip' => __( 'To hide this tab from some categories, enter categories here.', 'woocommerce-jetpack' ),
|
722 |
+
'id' => 'wcj_custom_product_tabs_local_hide_in_cats_' . $i,
|
723 |
+
'default' => '',
|
724 |
+
'class' => 'chosen_select',
|
725 |
+
'type' => 'multiselect',
|
726 |
+
'options' => $product_cats_options,
|
727 |
+
),
|
728 |
+
array(
|
729 |
+
'title' => '',
|
730 |
+
'desc' => __( 'CATEGORIES to SHOW this tab', 'woocommerce-jetpack' ),
|
731 |
+
'desc_tip' => __( 'To show this tab only for some categories, enter categories here.', 'woocommerce-jetpack' ),
|
732 |
+
'id' => 'wcj_custom_product_tabs_local_show_in_cats_' . $i,
|
733 |
+
'default' => '',
|
734 |
+
'class' => 'chosen_select',
|
735 |
+
'type' => 'multiselect',
|
736 |
+
'options' => $product_cats_options,
|
737 |
+
),
|
738 |
+
array(
|
739 |
+
'title' => '',
|
740 |
+
'desc' => __( 'TAGS to HIDE this tab', 'woocommerce-jetpack' ),
|
741 |
+
'desc_tip' => __( 'To hide this tab from some tags, enter tags here.', 'woocommerce-jetpack' ),
|
742 |
+
'id' => 'wcj_custom_product_tabs_local_hide_in_tags_' . $i,
|
743 |
+
'default' => '',
|
744 |
+
'class' => 'chosen_select',
|
745 |
+
'type' => 'multiselect',
|
746 |
+
'options' => $product_tags_options,
|
747 |
+
),
|
748 |
+
array(
|
749 |
+
'title' => '',
|
750 |
+
'desc' => __( 'TAGS to SHOW this tab', 'woocommerce-jetpack' ),
|
751 |
+
'desc_tip' => __( 'To show this tab only for some tags, enter tags here.', 'woocommerce-jetpack' ),
|
752 |
+
'id' => 'wcj_custom_product_tabs_local_show_in_tags_' . $i,
|
753 |
+
'default' => '',
|
754 |
+
'class' => 'chosen_select',
|
755 |
+
'type' => 'multiselect',
|
756 |
+
'options' => $product_tags_options,
|
757 |
+
),
|
758 |
+
) );
|
759 |
+
}
|
760 |
|
761 |
+
$settings = array_merge( $settings, array(
|
762 |
array(
|
763 |
'type' => 'sectionend',
|
764 |
'id' => 'wcj_custom_product_tabs_options_local',
|
765 |
),
|
|
|
766 |
// Standard WooCommerce Tabs
|
767 |
array(
|
768 |
'title' => __( 'WooCommerce Standard Product Tabs Options', 'woocommerce-jetpack' ),
|
770 |
'desc' => __( 'This section lets you customize single product tabs.', 'woocommerce-jetpack' ),
|
771 |
'id' => 'wcj_product_info_product_tabs_options',
|
772 |
),
|
|
|
773 |
array(
|
774 |
'title' => __( 'Description Tab', 'woocommerce-jetpack' ),
|
775 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
777 |
'default' => 'no',
|
778 |
'type' => 'checkbox',
|
779 |
),
|
|
|
780 |
array(
|
781 |
'title' => '',
|
782 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
785 |
'default' => '',
|
786 |
'type' => 'text',
|
787 |
),
|
|
|
788 |
array(
|
789 |
'title' => '',
|
790 |
'id' => 'wcj_product_info_product_tabs_description_priority',
|
793 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
794 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
795 |
),
|
|
|
796 |
array(
|
797 |
'title' => __( 'Additional Information Tab', 'woocommerce-jetpack' ),
|
798 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
800 |
'default' => 'no',
|
801 |
'type' => 'checkbox',
|
802 |
),
|
|
|
803 |
array(
|
804 |
'title' => '',
|
805 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
808 |
'default' => '',
|
809 |
'type' => 'text',
|
810 |
),
|
|
|
811 |
array(
|
812 |
'title' => '',
|
813 |
'id' => 'wcj_product_info_product_tabs_additional_information_priority',
|
816 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
817 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
818 |
),
|
|
|
819 |
array(
|
820 |
'title' => __( 'Reviews Tab', 'woocommerce-jetpack' ),
|
821 |
'desc' => __( 'Remove tab from product page', 'woocommerce-jetpack' ),
|
823 |
'default' => 'no',
|
824 |
'type' => 'checkbox',
|
825 |
),
|
|
|
826 |
array(
|
827 |
'title' => '',
|
828 |
'desc' => __( 'Title.', 'woocommerce-jetpack' ),
|
831 |
'default' => '',
|
832 |
'type' => 'text',
|
833 |
),
|
|
|
834 |
array(
|
835 |
'title' => '',
|
836 |
'id' => 'wcj_product_info_product_tabs_reviews_priority',
|
839 |
'desc' => __( 'Priority (i.e. Order).', 'woocommerce-jetpack' ) . ' ' . apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
|
840 |
'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
|
841 |
),
|
|
|
842 |
array(
|
843 |
'type' => 'sectionend',
|
844 |
'id' => 'wcj_product_info_product_tabs_options',
|
845 |
),
|
|
|
846 |
) );
|
847 |
|
848 |
return $this->add_standard_settings( $settings );
|
includes/class-wcj-reports.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -26,7 +26,7 @@ class WCJ_Reports extends WCJ_Module {
|
|
26 |
/**
|
27 |
* Constructor.
|
28 |
*
|
29 |
-
* @version 2.4.
|
30 |
*/
|
31 |
public function __construct() {
|
32 |
|
@@ -46,6 +46,7 @@ class WCJ_Reports extends WCJ_Module {
|
|
46 |
include_once( 'reports/wcj-class-reports-customers.php' );
|
47 |
include_once( 'reports/wcj-class-reports-stock.php' );
|
48 |
include_once( 'reports/wcj-class-reports-sales.php' );
|
|
|
49 |
|
50 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_to_admin_bar' ), PHP_INT_MAX );
|
51 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_by_month_to_admin_bar' ), PHP_INT_MAX );
|
@@ -198,6 +199,16 @@ class WCJ_Reports extends WCJ_Module {
|
|
198 |
echo $report->get_report();
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
/**
|
202 |
* get_report_stock.
|
203 |
*/
|
@@ -220,7 +231,7 @@ class WCJ_Reports extends WCJ_Module {
|
|
220 |
/**
|
221 |
* Add reports to WooCommerce > Reports > Sales
|
222 |
*
|
223 |
-
* @version 2.
|
224 |
* @since 2.3.0
|
225 |
*/
|
226 |
public function add_sales_reports( $reports ) {
|
@@ -228,10 +239,17 @@ class WCJ_Reports extends WCJ_Module {
|
|
228 |
$reports['orders']['reports']['booster_products_sales'] = array(
|
229 |
'title' => __( 'Booster: Product Sales', 'woocommerce-jetpack' ),
|
230 |
'description' => '',
|
231 |
-
'hide_title' =>
|
232 |
'callback' => array( $this, 'get_report_sales' ),
|
233 |
);
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
return $reports;
|
236 |
}
|
237 |
|
@@ -289,31 +307,82 @@ class WCJ_Reports extends WCJ_Module {
|
|
289 |
/*
|
290 |
* Add the settings.
|
291 |
*
|
292 |
-
* @version 2.4.
|
293 |
*/
|
294 |
function get_settings() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
$settings = array(
|
296 |
array(
|
297 |
'title' => __( 'Available Reports', 'woocommerce-jetpack' ),
|
298 |
'type' => 'title',
|
299 |
-
'desc' => '<p>'
|
300 |
-
. __( 'Booster: Customers by Country. Available in WooCommerce > Reports > Customers.', 'woocommerce-jetpack' )
|
301 |
-
. '</p><p>'
|
302 |
-
. __( 'Booster: Customers by Country Sets. Available in WooCommerce > Reports > Customers.', 'woocommerce-jetpack' )
|
303 |
-
. '</p><p>'
|
304 |
-
. __( 'Booster: All in Stock with sales data. Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
305 |
-
. '</p><p>'
|
306 |
-
. __( 'Booster: Understocked products (calculated by sales data). Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
307 |
-
. '</p><p>'
|
308 |
-
. __( 'Booster: Overstocked products (calculated by sales data). Available in WooCommerce > Reports > Stock.', 'woocommerce-jetpack' )
|
309 |
-
. '</p>',
|
310 |
'id' => 'wcj_reports_more_options'
|
311 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
array(
|
313 |
'type' => 'sectionend',
|
314 |
'id' => 'wcj_reports_more_options',
|
315 |
),
|
316 |
-
);
|
317 |
return $this->add_standard_settings( $settings );
|
318 |
}
|
319 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Reports class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
26 |
/**
|
27 |
* Constructor.
|
28 |
*
|
29 |
+
* @version 2.4.7
|
30 |
*/
|
31 |
public function __construct() {
|
32 |
|
46 |
include_once( 'reports/wcj-class-reports-customers.php' );
|
47 |
include_once( 'reports/wcj-class-reports-stock.php' );
|
48 |
include_once( 'reports/wcj-class-reports-sales.php' );
|
49 |
+
include_once( 'reports/wcj-class-reports-monthly-sales.php' );
|
50 |
|
51 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_to_admin_bar' ), PHP_INT_MAX );
|
52 |
add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_by_month_to_admin_bar' ), PHP_INT_MAX );
|
199 |
echo $report->get_report();
|
200 |
}
|
201 |
|
202 |
+
/**
|
203 |
+
* get_report_monthly_sales.
|
204 |
+
* @version 2.4.7
|
205 |
+
* @since 2.4.7
|
206 |
+
*/
|
207 |
+
function get_report_monthly_sales() {
|
208 |
+
$report = new WCJ_Reports_Monthly_Sales();
|
209 |
+
echo $report->get_report();
|
210 |
+
}
|
211 |
+
|
212 |
/**
|
213 |
* get_report_stock.
|
214 |
*/
|
231 |
/**
|
232 |
* Add reports to WooCommerce > Reports > Sales
|
233 |
*
|
234 |
+
* @version 2.4.7
|
235 |
* @since 2.3.0
|
236 |
*/
|
237 |
public function add_sales_reports( $reports ) {
|
239 |
$reports['orders']['reports']['booster_products_sales'] = array(
|
240 |
'title' => __( 'Booster: Product Sales', 'woocommerce-jetpack' ),
|
241 |
'description' => '',
|
242 |
+
'hide_title' => false,
|
243 |
'callback' => array( $this, 'get_report_sales' ),
|
244 |
);
|
245 |
|
246 |
+
$reports['orders']['reports']['booster_monthly_sales'] = array(
|
247 |
+
'title' => __( 'Booster: Monthly Sales', 'woocommerce-jetpack' ) . ' <sup>[' . __( 'Beta', 'woocommerce-jetpack' ) . ']</sup>',
|
248 |
+
'description' => '',
|
249 |
+
'hide_title' => false,
|
250 |
+
'callback' => array( $this, 'get_report_monthly_sales' ),
|
251 |
+
);
|
252 |
+
|
253 |
return $reports;
|
254 |
}
|
255 |
|
307 |
/*
|
308 |
* Add the settings.
|
309 |
*
|
310 |
+
* @version 2.4.7
|
311 |
*/
|
312 |
function get_settings() {
|
313 |
+
$reports = array(
|
314 |
+
array(
|
315 |
+
'title' => __( 'Product Sales', 'woocommerce-jetpack' ),
|
316 |
+
'tab' => 'orders',
|
317 |
+
'tab_title' => 'Orders',
|
318 |
+
'report' => 'booster_products_sales',
|
319 |
+
),
|
320 |
+
array(
|
321 |
+
'title' => __( 'Monthly Sales (with currency conversions)', 'woocommerce-jetpack' ),
|
322 |
+
'tab' => 'orders',
|
323 |
+
'tab_title' => 'Orders',
|
324 |
+
'report' => 'booster_monthly_sales',
|
325 |
+
),
|
326 |
+
array(
|
327 |
+
'title' => __( 'Customers by Country', 'woocommerce-jetpack' ),
|
328 |
+
'tab' => 'customers',
|
329 |
+
'tab_title' => 'Customers',
|
330 |
+
'report' => 'customers_by_country',
|
331 |
+
),
|
332 |
+
array(
|
333 |
+
'title' => __( 'Customers by Country Sets', 'woocommerce-jetpack' ),
|
334 |
+
'tab' => 'customers',
|
335 |
+
'tab_title' => 'Customers',
|
336 |
+
'report' => 'customers_by_country_sets',
|
337 |
+
),
|
338 |
+
array(
|
339 |
+
'title' => __( 'All in Stock with sales data', 'woocommerce-jetpack' ),
|
340 |
+
'tab' => 'stock',
|
341 |
+
'tab_title' => 'Stock',
|
342 |
+
'report' => 'on_stock',
|
343 |
+
),
|
344 |
+
array(
|
345 |
+
'title' => __( 'Understocked products (calculated by sales data)', 'woocommerce-jetpack' ),
|
346 |
+
'tab' => 'stock',
|
347 |
+
'tab_title' => 'Stock',
|
348 |
+
'report' => 'understocked',
|
349 |
+
),
|
350 |
+
array(
|
351 |
+
'title' => __( 'Overstocked products (calculated by sales data)', 'woocommerce-jetpack' ),
|
352 |
+
'tab' => 'stock',
|
353 |
+
'tab_title' => 'Stock',
|
354 |
+
'report' => 'overstocked',
|
355 |
+
),
|
356 |
+
);
|
357 |
$settings = array(
|
358 |
array(
|
359 |
'title' => __( 'Available Reports', 'woocommerce-jetpack' ),
|
360 |
'type' => 'title',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
'id' => 'wcj_reports_more_options'
|
362 |
),
|
363 |
+
);
|
364 |
+
// $button_style = "background: red; border-color: red; box-shadow: 0 1px 0 red; text-shadow: 0 -1px 1px #a00,1px 0 1px #a00,0 1px 1px #a00,-1px 0 1px #a00;";
|
365 |
+
$button_style = '';
|
366 |
+
foreach ( $reports as $report ) {
|
367 |
+
$settings = array_merge( $settings, array(
|
368 |
+
array(
|
369 |
+
// 'title' => 'WooCommerce > Reports > ' . $report['tab_title'] . ' > ' . $report['title'],
|
370 |
+
'title' => '[' . $report['tab_title'] . '] ' . $report['title'],
|
371 |
+
'id' => 'wcj_' . $report['report'] . '_link',
|
372 |
+
'type' => 'custom_link',
|
373 |
+
'link' => '<a class="button-primary" '
|
374 |
+
. 'style="' . $button_style . '" '
|
375 |
+
. 'href="' . get_admin_url() . 'admin.php?page=wc-reports&tab=' . $report['tab'] . '&report=' . $report['report'] . '">'
|
376 |
+
. __( 'View report', 'woocommerce-jetpack' ) . '</a>',
|
377 |
+
),
|
378 |
+
) );
|
379 |
+
}
|
380 |
+
$settings = array_merge( $settings, array(
|
381 |
array(
|
382 |
'type' => 'sectionend',
|
383 |
'id' => 'wcj_reports_more_options',
|
384 |
),
|
385 |
+
) );
|
386 |
return $this->add_standard_settings( $settings );
|
387 |
}
|
388 |
}
|
includes/classes/class-wcj-module.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Module class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -357,7 +357,7 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
|
|
357 |
/**
|
358 |
* add_reset_settings_button.
|
359 |
*
|
360 |
-
* @version 2.4.
|
361 |
* @since 2.4.0
|
362 |
*/
|
363 |
function add_reset_settings_button( $settings ) {
|
@@ -369,7 +369,9 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
|
|
369 |
'id' => 'wcj_' . $this->id . '_reset_settings_options',
|
370 |
),
|
371 |
array(
|
372 |
-
'title' =>
|
|
|
|
|
373 |
'id' => 'wcj_' . $this->id . '_reset_settings',
|
374 |
'type' => 'custom_link',
|
375 |
'link' => '<a class="button-primary" style="' . $reset_button_style . '" href="' . add_query_arg( 'wcj_reset_settings', $this->id, remove_query_arg( 'wcj_confirm_reset_settings' ) ) . '">' . __( 'Reset settings', 'woocommerce-jetpack' ) . '</a>',
|
@@ -392,14 +394,17 @@ if ( ! class_exists( 'WCJ_Module' ) ) :
|
|
392 |
* settings_section.
|
393 |
* only for `module`
|
394 |
*
|
395 |
-
* @version 2.4.
|
396 |
*/
|
397 |
function add_enable_module_setting( $settings, $module_desc = '' ) {
|
|
|
|
|
|
|
398 |
$the_link = '';
|
399 |
if ( isset( $this->link ) && '' != $this->link ) {
|
400 |
$the_link = ' <a class="button-primary"' .
|
401 |
' style="background: green; border-color: green; box-shadow: 0 1px 0 green; text-shadow: 0 -1px 1px #0a0,1px 0 1px #0a0,0 1px 1px #0a0,-1px 0 1px #0a0;"' .
|
402 |
-
' href="' . $this->link . '" target="_blank">' . __( 'Documentation', 'woocommerce-jetpack' ) . '</a>';
|
403 |
}
|
404 |
$enable_module_setting = array(
|
405 |
array(
|
4 |
*
|
5 |
* The WooCommerce Jetpack Module class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.2.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
357 |
/**
|
358 |
* add_reset_settings_button.
|
359 |
*
|
360 |
+
* @version 2.4.7
|
361 |
* @since 2.4.0
|
362 |
*/
|
363 |
function add_reset_settings_button( $settings ) {
|
369 |
'id' => 'wcj_' . $this->id . '_reset_settings_options',
|
370 |
),
|
371 |
array(
|
372 |
+
'title' => ( 'module' === $this->type ) ?
|
373 |
+
__( 'Reset Module to Default Settings', 'woocommerce-jetpack' ) :
|
374 |
+
__( 'Reset Submodule to Default Settings', 'woocommerce-jetpack' ),
|
375 |
'id' => 'wcj_' . $this->id . '_reset_settings',
|
376 |
'type' => 'custom_link',
|
377 |
'link' => '<a class="button-primary" style="' . $reset_button_style . '" href="' . add_query_arg( 'wcj_reset_settings', $this->id, remove_query_arg( 'wcj_confirm_reset_settings' ) ) . '">' . __( 'Reset settings', 'woocommerce-jetpack' ) . '</a>',
|
394 |
* settings_section.
|
395 |
* only for `module`
|
396 |
*
|
397 |
+
* @version 2.4.7
|
398 |
*/
|
399 |
function add_enable_module_setting( $settings, $module_desc = '' ) {
|
400 |
+
if ( 'module' != $this->type ) {
|
401 |
+
return $settings;
|
402 |
+
}
|
403 |
$the_link = '';
|
404 |
if ( isset( $this->link ) && '' != $this->link ) {
|
405 |
$the_link = ' <a class="button-primary"' .
|
406 |
' style="background: green; border-color: green; box-shadow: 0 1px 0 green; text-shadow: 0 -1px 1px #0a0,1px 0 1px #0a0,0 1px 1px #0a0,-1px 0 1px #0a0;"' .
|
407 |
+
' href="' . $this->link . '?source=module_documentation_button" target="_blank">' . __( 'Documentation', 'woocommerce-jetpack' ) . '</a>';
|
408 |
}
|
409 |
$enable_module_setting = array(
|
410 |
array(
|
includes/input-fields/class-wcj-product-input-fields-abstract.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields abstract class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -27,7 +27,7 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
27 |
/**
|
28 |
* get_options.
|
29 |
*
|
30 |
-
* @version 2.4.
|
31 |
*/
|
32 |
public function get_options() {
|
33 |
$options = array(
|
@@ -136,6 +136,23 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
136 |
'default' => 365,
|
137 |
),
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
array(
|
140 |
'id' => 'wcj_product_input_fields_type_datepicker_firstday_' . $this->scope . '_',
|
141 |
'title' => __( 'If datepicker/weekpicker is selected, set first week day here', 'woocommerce-jetpack' ),
|
@@ -421,7 +438,7 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
421 |
/**
|
422 |
* add_product_input_fields_to_frontend.
|
423 |
*
|
424 |
-
* @version 2.4.
|
425 |
*/
|
426 |
public function add_product_input_fields_to_frontend() {
|
427 |
global $product;
|
@@ -440,10 +457,17 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
440 |
if ( '' == $datepicker_format ) {
|
441 |
$datepicker_format = get_option( 'date_format' );
|
442 |
}
|
443 |
-
$datepicker_format
|
444 |
-
$datepicker_mindate
|
445 |
-
$datepicker_maxdate
|
446 |
-
$datepicker_firstday
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
|
448 |
$timepicker_format = $this->get_value( 'wcj_product_input_fields_type_timepicker_format_' . $this->scope . '_' . $i, $product->id, 'hh:mm p' );
|
449 |
$timepicker_interval = $this->get_value( 'wcj_product_input_fields_type_timepicker_interval_' . $this->scope . '_' . $i, $product->id, 15 );
|
@@ -481,12 +505,12 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
481 |
|
482 |
case 'datepicker':
|
483 |
|
484 |
-
echo '<p>' . $title . '<input firstday="' . $datepicker_firstday . '" dateformat="' . $datepicker_format . '" mindate="' . $datepicker_mindate . '" maxdate="' . $datepicker_maxdate . '" type="' . $type . '" display="date" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
|
485 |
break;
|
486 |
|
487 |
case 'weekpicker':
|
488 |
|
489 |
-
echo '<p>' . $title . '<input firstday="' . $datepicker_firstday . '" dateformat="' . $datepicker_format . '" mindate="' . $datepicker_mindate . '" maxdate="' . $datepicker_maxdate . '" type="' . $type . '" display="week" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
|
490 |
break;
|
491 |
|
492 |
case 'timepicker':
|
@@ -628,7 +652,7 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
628 |
/**
|
629 |
* Adds product input values to order details (and emails).
|
630 |
*
|
631 |
-
* @version 2.4.
|
632 |
*/
|
633 |
public function add_product_input_fields_to_order_item_name( $name, $item, $is_cart = false ) {
|
634 |
|
@@ -667,7 +691,7 @@ class WCJ_Product_Input_Fields_Abstract {
|
|
667 |
|
668 |
if ( 'file' === $type ) {
|
669 |
$value = maybe_unserialize( $value );
|
670 |
-
$value = $value['name'];
|
671 |
}
|
672 |
|
673 |
if ( '' != $value ) {
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Input Fields abstract class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
27 |
/**
|
28 |
* get_options.
|
29 |
*
|
30 |
+
* @version 2.4.7
|
31 |
*/
|
32 |
public function get_options() {
|
33 |
$options = array(
|
136 |
'default' => 365,
|
137 |
),
|
138 |
|
139 |
+
array(
|
140 |
+
'id' => 'wcj_product_input_fields_type_datepicker_changeyear_' . $this->scope . '_',
|
141 |
+
'title' => __( 'If datepicker/weekpicker is selected, set if you want to add year selector', 'woocommerce-jetpack' ),
|
142 |
+
'short_title' => __( 'Datepicker/Weekpicker: Change year', 'woocommerce-jetpack' ),
|
143 |
+
'type' => 'checkbox',
|
144 |
+
'default' => 'no',
|
145 |
+
),
|
146 |
+
|
147 |
+
array(
|
148 |
+
'id' => 'wcj_product_input_fields_type_datepicker_yearrange_' . $this->scope . '_',
|
149 |
+
'title' => __( 'If datepicker/weekpicker is selected, and year selector is enabled, set year range here', 'woocommerce-jetpack' ),
|
150 |
+
'short_title' => __( 'Datepicker/Weekpicker: Year range', 'woocommerce-jetpack' ),
|
151 |
+
// 'desc_tip' => __( 'The range of years displayed in the year drop-down: either relative to today\'s year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn"). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.', 'woocommerce-jetpack' ),
|
152 |
+
'type' => 'text',
|
153 |
+
'default' => 'c-10:c+10',
|
154 |
+
),
|
155 |
+
|
156 |
array(
|
157 |
'id' => 'wcj_product_input_fields_type_datepicker_firstday_' . $this->scope . '_',
|
158 |
'title' => __( 'If datepicker/weekpicker is selected, set first week day here', 'woocommerce-jetpack' ),
|
438 |
/**
|
439 |
* add_product_input_fields_to_frontend.
|
440 |
*
|
441 |
+
* @version 2.4.7
|
442 |
*/
|
443 |
public function add_product_input_fields_to_frontend() {
|
444 |
global $product;
|
457 |
if ( '' == $datepicker_format ) {
|
458 |
$datepicker_format = get_option( 'date_format' );
|
459 |
}
|
460 |
+
$datepicker_format = wcj_date_format_php_to_js_v2( $datepicker_format );
|
461 |
+
$datepicker_mindate = $this->get_value( 'wcj_product_input_fields_type_datepicker_mindate_' . $this->scope . '_' . $i, $product->id, -365 );
|
462 |
+
$datepicker_maxdate = $this->get_value( 'wcj_product_input_fields_type_datepicker_maxdate_' . $this->scope . '_' . $i, $product->id, 365 );
|
463 |
+
$datepicker_firstday = $this->get_value( 'wcj_product_input_fields_type_datepicker_firstday_' . $this->scope . '_' . $i, $product->id, 0 );
|
464 |
+
$datepicker_changeyear = $this->get_value( 'wcj_product_input_fields_type_datepicker_changeyear_' . $this->scope . '_' . $i, $product->id, 'no' );
|
465 |
+
$datepicker_yearrange = $this->get_value( 'wcj_product_input_fields_type_datepicker_yearrange_' . $this->scope . '_' . $i, $product->id, 'c-10:c+10' );
|
466 |
+
if ( 'on' === $datepicker_changeyear || 'yes' === $datepicker_changeyear ) {
|
467 |
+
$datepicker_year = 'changeyear="1" yearRange="' . $datepicker_yearrange . '" ';
|
468 |
+
} else {
|
469 |
+
$datepicker_year = '';
|
470 |
+
}
|
471 |
|
472 |
$timepicker_format = $this->get_value( 'wcj_product_input_fields_type_timepicker_format_' . $this->scope . '_' . $i, $product->id, 'hh:mm p' );
|
473 |
$timepicker_interval = $this->get_value( 'wcj_product_input_fields_type_timepicker_interval_' . $this->scope . '_' . $i, $product->id, 15 );
|
505 |
|
506 |
case 'datepicker':
|
507 |
|
508 |
+
echo '<p>' . $title . '<input ' . $datepicker_year . 'firstday="' . $datepicker_firstday . '" dateformat="' . $datepicker_format . '" mindate="' . $datepicker_mindate . '" maxdate="' . $datepicker_maxdate . '" type="' . $type . '" display="date" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
|
509 |
break;
|
510 |
|
511 |
case 'weekpicker':
|
512 |
|
513 |
+
echo '<p>' . $title . '<input ' . $datepicker_year . 'firstday="' . $datepicker_firstday . '" dateformat="' . $datepicker_format . '" mindate="' . $datepicker_mindate . '" maxdate="' . $datepicker_maxdate . '" type="' . $type . '" display="week" name="' . $field_name . '" placeholder="' . $placeholder . '"' . $custom_attributes . '>' . '</p>';
|
514 |
break;
|
515 |
|
516 |
case 'timepicker':
|
652 |
/**
|
653 |
* Adds product input values to order details (and emails).
|
654 |
*
|
655 |
+
* @version 2.4.7
|
656 |
*/
|
657 |
public function add_product_input_fields_to_order_item_name( $name, $item, $is_cart = false ) {
|
658 |
|
691 |
|
692 |
if ( 'file' === $type ) {
|
693 |
$value = maybe_unserialize( $value );
|
694 |
+
$value = ( isset( $value['name'] ) ) ? $value['name'] : '';
|
695 |
}
|
696 |
|
697 |
if ( '' != $value ) {
|
includes/js/wcj-datepicker.js
CHANGED
@@ -1,10 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function() {
|
2 |
jQuery("input[display='date']").each( function () {
|
3 |
jQuery(this).datepicker({
|
4 |
dateFormat : jQuery(this).attr("dateformat"),
|
5 |
minDate : jQuery(this).attr("mindate"),
|
6 |
maxDate : jQuery(this).attr("maxdate"),
|
7 |
-
firstDay : jQuery(this).attr("firstday")
|
|
|
|
|
8 |
});
|
9 |
});
|
10 |
});
|
1 |
+
/**
|
2 |
+
* wcj-datepicker.
|
3 |
+
*
|
4 |
+
* version 2.4.7
|
5 |
+
*/
|
6 |
jQuery(document).ready(function() {
|
7 |
jQuery("input[display='date']").each( function () {
|
8 |
jQuery(this).datepicker({
|
9 |
dateFormat : jQuery(this).attr("dateformat"),
|
10 |
minDate : jQuery(this).attr("mindate"),
|
11 |
maxDate : jQuery(this).attr("maxdate"),
|
12 |
+
firstDay : jQuery(this).attr("firstday"),
|
13 |
+
changeYear: jQuery(this).attr("changeyear"),
|
14 |
+
yearRange: jQuery(this).attr("yearrange")
|
15 |
});
|
16 |
});
|
17 |
});
|
includes/js/wcj-weekpicker.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function() {
|
2 |
jQuery("input[display='week']").each( function () {
|
3 |
jQuery(this).datepicker({
|
@@ -5,10 +10,11 @@ jQuery(document).ready(function() {
|
|
5 |
minDate : jQuery(this).attr("mindate"),
|
6 |
maxDate : jQuery(this).attr("maxdate"),
|
7 |
firstDay : jQuery(this).attr("firstday"),
|
|
|
|
|
8 |
showOtherMonths: true,
|
9 |
selectOtherMonths: true,
|
10 |
changeMonth: true,
|
11 |
-
changeYear: true,
|
12 |
showWeek: true,
|
13 |
beforeShow: function(dateText, inst) {
|
14 |
// for week highighting
|
1 |
+
/**
|
2 |
+
* wcj-weekpicker.
|
3 |
+
*
|
4 |
+
* version 2.4.7
|
5 |
+
*/
|
6 |
jQuery(document).ready(function() {
|
7 |
jQuery("input[display='week']").each( function () {
|
8 |
jQuery(this).datepicker({
|
10 |
minDate : jQuery(this).attr("mindate"),
|
11 |
maxDate : jQuery(this).attr("maxdate"),
|
12 |
firstDay : jQuery(this).attr("firstday"),
|
13 |
+
changeYear: jQuery(this).attr("changeyear"),
|
14 |
+
yearRange: jQuery(this).attr("yearrange"),
|
15 |
showOtherMonths: true,
|
16 |
selectOtherMonths: true,
|
17 |
changeMonth: true,
|
|
|
18 |
showWeek: true,
|
19 |
beforeShow: function(dateText, inst) {
|
20 |
// for week highighting
|
includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Report Tool class.
|
6 |
*
|
7 |
-
* @version 2.
|
8 |
* @since 2.2.1
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -48,7 +48,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
|
|
48 |
/**
|
49 |
* Add Invoices Report tool to WooCommerce menu (the content).
|
50 |
*
|
51 |
-
* @version 2.
|
52 |
*/
|
53 |
function create_invoices_report_tool() {
|
54 |
$result_message = '';
|
@@ -96,12 +96,12 @@ class WCJ_PDF_Invoicing_Report_Tool {
|
|
96 |
// Get Report Button
|
97 |
array(
|
98 |
'',
|
99 |
-
'<input class="button-primary" type="submit" name="get_invoices_report" value="' . __( 'Display monthly
|
100 |
),
|
101 |
// Get Report Zip Button
|
102 |
array(
|
103 |
'',
|
104 |
-
'<input class="button-primary" type="submit" name="get_invoices_report_zip" value="' . __( 'Download all monthly
|
105 |
),
|
106 |
);
|
107 |
// Print all
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Report Tool class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @since 2.2.1
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
48 |
/**
|
49 |
* Add Invoices Report tool to WooCommerce menu (the content).
|
50 |
*
|
51 |
+
* @version 2.4.7
|
52 |
*/
|
53 |
function create_invoices_report_tool() {
|
54 |
$result_message = '';
|
96 |
// Get Report Button
|
97 |
array(
|
98 |
'',
|
99 |
+
'<input class="button-primary" type="submit" name="get_invoices_report" value="' . __( 'Display monthly documents table', 'woocommerce-jetpack' ) . '">',
|
100 |
),
|
101 |
// Get Report Zip Button
|
102 |
array(
|
103 |
'',
|
104 |
+
'<input class="button-primary" type="submit" name="get_invoices_report_zip" value="' . __( 'Download all monthly documents PDFs in single ZIP file', 'woocommerce-jetpack' ) . '">',
|
105 |
),
|
106 |
);
|
107 |
// Print all
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Display class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -17,7 +17,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
function __construct() {
|
23 |
|
@@ -33,9 +33,95 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
33 |
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), 2 );
|
34 |
// Action Links on Customer's My Account page
|
35 |
add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'add_pdf_invoices_action_links' ), PHP_INT_MAX, 2 );
|
|
|
|
|
|
|
36 |
}
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* add_order_column.
|
41 |
*
|
@@ -55,7 +141,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
55 |
* Ouput custom columns for products
|
56 |
*
|
57 |
* @param string $column
|
58 |
-
* @version 2.
|
59 |
*/
|
60 |
public function render_order_columns( $column ) {
|
61 |
$invoice_types_ids = wcj_get_enabled_invoice_types_ids();
|
@@ -78,7 +164,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
78 |
. add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) )
|
79 |
. '">' . $the_number . '</a>';
|
80 |
|
81 |
-
// Delete button
|
82 |
$delete_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_delete_btn', __( 'Delete', 'woocommerce-jetpack' ) );
|
83 |
if ( '' != $delete_button_label ) {
|
84 |
$html .= ' ';
|
@@ -88,8 +174,8 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
88 |
remove_query_arg( 'create_invoice_for_order_id' )
|
89 |
);
|
90 |
$html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $delete_button_label . '</span></a>';
|
91 |
-
}
|
92 |
-
} else {
|
93 |
|
94 |
// Create Button
|
95 |
$create_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_create_btn', __( 'Create', 'woocommerce-jetpack' ) );
|
@@ -101,7 +187,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
101 |
);
|
102 |
$html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $create_button_label . '</span></a>';
|
103 |
}
|
104 |
-
}
|
105 |
echo $html;
|
106 |
}
|
107 |
|
@@ -140,7 +226,8 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
140 |
/**
|
141 |
* get_settings.
|
142 |
*
|
143 |
-
* @version 2.4.
|
|
|
144 |
*/
|
145 |
function get_settings() {
|
146 |
|
@@ -172,7 +259,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
172 |
'type' => 'text',
|
173 |
),
|
174 |
|
175 |
-
array(
|
176 |
'title' => '',
|
177 |
'desc' => __( 'Create Button', 'woocommerce-jetpack' ),
|
178 |
'desc_tip' => __( 'Set empty to disable the button', 'woocommerce-jetpack' ),
|
@@ -188,6 +275,27 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
188 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_column_delete_btn',
|
189 |
'default' => __( 'Delete', 'woocommerce-jetpack' ),
|
190 |
'type' => 'text',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
),
|
192 |
|
193 |
array(
|
@@ -230,7 +338,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
|
|
230 |
);
|
231 |
}
|
232 |
|
233 |
-
return $settings;
|
234 |
}
|
235 |
}
|
236 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Display class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
17 |
/**
|
18 |
* Constructor.
|
19 |
*
|
20 |
+
* @version 2.4.7
|
21 |
*/
|
22 |
function __construct() {
|
23 |
|
33 |
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), 2 );
|
34 |
// Action Links on Customer's My Account page
|
35 |
add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'add_pdf_invoices_action_links' ), PHP_INT_MAX, 2 );
|
36 |
+
// Action Buttons to Admin's Orders list
|
37 |
+
add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_pdf_invoices_admin_actions' ), PHP_INT_MAX, 2 );
|
38 |
+
add_filter( 'admin_head', array( $this, 'add_pdf_invoices_admin_actions_buttons_css' ) );
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* add_pdf_invoices_admin_actions_buttons_css.
|
44 |
+
*
|
45 |
+
* @version 2.4.7
|
46 |
+
* @since 2.4.7
|
47 |
+
*/
|
48 |
+
function add_pdf_invoices_admin_actions_buttons_css() {
|
49 |
+
echo '<style>' . PHP_EOL;
|
50 |
+
$invoice_types = wcj_get_enabled_invoice_types();
|
51 |
+
foreach ( $invoice_types as $invoice_type ) {
|
52 |
+
switch ( $invoice_type['id'] ) {
|
53 |
+
case 'invoice':
|
54 |
+
$color = 'green';
|
55 |
+
break;
|
56 |
+
case 'proforma_invoice':
|
57 |
+
$color = 'orange';
|
58 |
+
break;
|
59 |
+
case 'packing_slip':
|
60 |
+
$color = 'blue';
|
61 |
+
break;
|
62 |
+
case 'credit_note':
|
63 |
+
$color = 'red';
|
64 |
+
break;
|
65 |
+
default: // 'custom_doc'
|
66 |
+
$color = 'gray';
|
67 |
+
break;
|
68 |
+
}
|
69 |
+
echo '.view.' . $invoice_type['id'] . '{ color: ' . $color . ' !important; }' . PHP_EOL;
|
70 |
+
echo '.view.' . $invoice_type['id'] . '_' . 'create' . '{ color: ' . $color . ' !important; }' . PHP_EOL;
|
71 |
+
echo '.view.' . $invoice_type['id'] . '_' . 'delete' . '{ color: ' . $color . ' !important; }' . PHP_EOL;
|
72 |
+
echo '.view.' . $invoice_type['id'] . '::after { content: "\e028" !important; }' . PHP_EOL;
|
73 |
+
echo '.view.' . $invoice_type['id'] . '_' . 'create' . '::after { content: "\e027" !important; }' . PHP_EOL;
|
74 |
+
echo '.view.' . $invoice_type['id'] . '_' . 'delete' . '::after { content: "\e030" !important; }' . PHP_EOL;
|
75 |
+
}
|
76 |
+
echo '</style>' . PHP_EOL;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* add_pdf_invoices_admin_actions.
|
81 |
+
*
|
82 |
+
* @version 2.4.7
|
83 |
+
* @since 2.4.7
|
84 |
+
*/
|
85 |
+
function add_pdf_invoices_admin_actions( $actions, $the_order ) {
|
86 |
+
$invoice_types = wcj_get_enabled_invoice_types();
|
87 |
+
foreach ( $invoice_types as $invoice_type ) {
|
88 |
+
if ( wcj_is_invoice_created( $the_order->id, $invoice_type['id'] ) ) {
|
89 |
+
if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_view_btn', 'no' ) ) {
|
90 |
+
// Document (View) button
|
91 |
+
$query_args = array( 'order_id' => $the_order->id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
|
92 |
+
if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
|
93 |
+
$query_args['save_pdf_invoice'] = '1';
|
94 |
+
}
|
95 |
+
$the_url = add_query_arg( $query_args, remove_query_arg( array ( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) );
|
96 |
+
$the_name = __( 'View', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
|
97 |
+
$the_action = 'view ' . $invoice_type['id'];
|
98 |
+
$the_action_id = $invoice_type['id'];
|
99 |
+
$actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action, );
|
100 |
+
}
|
101 |
+
if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn', 'yes' ) ) {
|
102 |
+
// Delete button
|
103 |
+
$query_args = array( 'delete_invoice_for_order_id' => $the_order->id, 'invoice_type_id' => $invoice_type['id'] );
|
104 |
+
$the_url = add_query_arg( $query_args, remove_query_arg( 'create_invoice_for_order_id' ) );
|
105 |
+
$the_name = __( 'Delete', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
|
106 |
+
$the_action = 'view ' . $invoice_type['id'] . '_' . 'delete';
|
107 |
+
$the_action_id = $invoice_type['id'] . '_' . 'delete';
|
108 |
+
$actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action, );
|
109 |
+
}
|
110 |
+
} else {
|
111 |
+
if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn', 'yes' ) ) {
|
112 |
+
// Create button
|
113 |
+
$query_args = array( 'create_invoice_for_order_id' => $the_order->id, 'invoice_type_id' => $invoice_type['id'] );
|
114 |
+
$the_url = add_query_arg( $query_args, remove_query_arg( 'delete_invoice_for_order_id' ) );
|
115 |
+
$the_name = __( 'Create', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
|
116 |
+
$the_action = 'view ' . $invoice_type['id'] . '_' . 'create';
|
117 |
+
$the_action_id = $invoice_type['id'] . '_' . 'create';
|
118 |
+
$actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action, );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
return $actions;
|
123 |
+
}
|
124 |
+
|
125 |
/**
|
126 |
* add_order_column.
|
127 |
*
|
141 |
* Ouput custom columns for products
|
142 |
*
|
143 |
* @param string $column
|
144 |
+
* @version 2.4.7
|
145 |
*/
|
146 |
public function render_order_columns( $column ) {
|
147 |
$invoice_types_ids = wcj_get_enabled_invoice_types_ids();
|
164 |
. add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) )
|
165 |
. '">' . $the_number . '</a>';
|
166 |
|
167 |
+
/* // Delete button
|
168 |
$delete_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_delete_btn', __( 'Delete', 'woocommerce-jetpack' ) );
|
169 |
if ( '' != $delete_button_label ) {
|
170 |
$html .= ' ';
|
174 |
remove_query_arg( 'create_invoice_for_order_id' )
|
175 |
);
|
176 |
$html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $delete_button_label . '</span></a>';
|
177 |
+
} */
|
178 |
+
} /* else {
|
179 |
|
180 |
// Create Button
|
181 |
$create_button_label = get_option( 'wcj_invoicing_' . $invoice_type_id . '_admin_column_create_btn', __( 'Create', 'woocommerce-jetpack' ) );
|
187 |
);
|
188 |
$html .= '"><span style="color:gray;font-style:italic;font-size:x-small;text-decoration:underline;">' . $create_button_label . '</span></a>';
|
189 |
}
|
190 |
+
} */
|
191 |
echo $html;
|
192 |
}
|
193 |
|
226 |
/**
|
227 |
* get_settings.
|
228 |
*
|
229 |
+
* @version 2.4.7
|
230 |
+
* @todo "edit order" metabox; confirmation on create/delete;
|
231 |
*/
|
232 |
function get_settings() {
|
233 |
|
259 |
'type' => 'text',
|
260 |
),
|
261 |
|
262 |
+
/* array(
|
263 |
'title' => '',
|
264 |
'desc' => __( 'Create Button', 'woocommerce-jetpack' ),
|
265 |
'desc_tip' => __( 'Set empty to disable the button', 'woocommerce-jetpack' ),
|
275 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_column_delete_btn',
|
276 |
'default' => __( 'Delete', 'woocommerce-jetpack' ),
|
277 |
'type' => 'text',
|
278 |
+
), */
|
279 |
+
|
280 |
+
array(
|
281 |
+
'desc' => __( 'Add View Button', 'woocommerce-jetpack' ),
|
282 |
+
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_view_btn',
|
283 |
+
'default' => 'no',
|
284 |
+
'type' => 'checkbox',
|
285 |
+
),
|
286 |
+
|
287 |
+
array(
|
288 |
+
'desc' => __( 'Add Create Button', 'woocommerce-jetpack' ),
|
289 |
+
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn',
|
290 |
+
'default' => 'yes',
|
291 |
+
'type' => 'checkbox',
|
292 |
+
),
|
293 |
+
|
294 |
+
array(
|
295 |
+
'desc' => __( 'Add Delete Button', 'woocommerce-jetpack' ),
|
296 |
+
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn',
|
297 |
+
'default' => 'yes',
|
298 |
+
'type' => 'checkbox',
|
299 |
),
|
300 |
|
301 |
array(
|
338 |
);
|
339 |
}
|
340 |
|
341 |
+
return $this->add_standard_settings( $settings );
|
342 |
}
|
343 |
}
|
344 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-emails.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Emails class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -95,7 +95,7 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
|
95 |
/**
|
96 |
* get_settings.
|
97 |
*
|
98 |
-
* @version 2.4.
|
99 |
*/
|
100 |
function get_settings() {
|
101 |
|
@@ -142,7 +142,7 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
|
|
142 |
);
|
143 |
}
|
144 |
|
145 |
-
return $settings;
|
146 |
}
|
147 |
}
|
148 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Emails class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
95 |
/**
|
96 |
* get_settings.
|
97 |
*
|
98 |
+
* @version 2.4.7
|
99 |
*/
|
100 |
function get_settings() {
|
101 |
|
142 |
);
|
143 |
}
|
144 |
|
145 |
+
return $this->add_standard_settings( $settings );
|
146 |
}
|
147 |
}
|
148 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-footer.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Footer class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -28,7 +28,7 @@ class WCJ_PDF_Invoicing_Footer extends WCJ_Module {
|
|
28 |
/**
|
29 |
* get_settings.
|
30 |
*
|
31 |
-
* @version 2.4.
|
32 |
*/
|
33 |
function get_settings() {
|
34 |
$settings = array();
|
@@ -83,7 +83,7 @@ class WCJ_PDF_Invoicing_Footer extends WCJ_Module {
|
|
83 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_footer_options',
|
84 |
);
|
85 |
}
|
86 |
-
return $settings;
|
87 |
}
|
88 |
}
|
89 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Footer class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
28 |
/**
|
29 |
* get_settings.
|
30 |
*
|
31 |
+
* @version 2.4.7
|
32 |
*/
|
33 |
function get_settings() {
|
34 |
$settings = array();
|
83 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_footer_options',
|
84 |
);
|
85 |
}
|
86 |
+
return $this->add_standard_settings( $settings );
|
87 |
}
|
88 |
}
|
89 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-header.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Header class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -30,7 +30,7 @@ class WCJ_PDF_Invoicing_Header extends WCJ_Module {
|
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
-
* @version 2.4.
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
$settings = array();
|
@@ -128,7 +128,7 @@ class WCJ_PDF_Invoicing_Header extends WCJ_Module {
|
|
128 |
),
|
129 |
) );
|
130 |
|
131 |
-
return $settings;
|
132 |
}
|
133 |
}
|
134 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Header class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
+
* @version 2.4.7
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
$settings = array();
|
128 |
),
|
129 |
) );
|
130 |
|
131 |
+
return $this->add_standard_settings( $settings );
|
132 |
}
|
133 |
}
|
134 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-numbering.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Numbering class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -30,7 +30,7 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
|
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
-
* @version 2.4.
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
$settings = array();
|
@@ -76,7 +76,7 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
|
|
76 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options',
|
77 |
);
|
78 |
}
|
79 |
-
return $settings;
|
80 |
}
|
81 |
}
|
82 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Numbering class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
+
* @version 2.4.7
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
$settings = array();
|
76 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_numbering_options',
|
77 |
);
|
78 |
}
|
79 |
+
return $this->add_standard_settings( $settings );
|
80 |
}
|
81 |
}
|
82 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-page.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Page class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -27,17 +27,375 @@ class WCJ_PDF_Invoicing_Page extends WCJ_Module {
|
|
27 |
parent::__construct( 'submodule' );
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
-
* @version 2.4.
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
$settings = array();
|
37 |
-
$page_formats = array();
|
38 |
-
for ( $i = 1; $i < 8; $i++ ) {
|
39 |
-
$page_formats[ 'A' . $i ] = 'A' . $i;
|
40 |
-
}
|
41 |
$invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
|
42 |
foreach ( $invoice_types as $invoice_type ) {
|
43 |
$settings[] = array(
|
@@ -60,7 +418,7 @@ class WCJ_PDF_Invoicing_Page extends WCJ_Module {
|
|
60 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_page_format',
|
61 |
'default' => 'A4',
|
62 |
'type' => 'select',
|
63 |
-
'options' => $
|
64 |
);
|
65 |
$settings[] = array(
|
66 |
'title' => __( 'Margin Left', 'woocommerce-jetpack' ),
|
@@ -91,7 +449,7 @@ class WCJ_PDF_Invoicing_Page extends WCJ_Module {
|
|
91 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_page_options',
|
92 |
);
|
93 |
}
|
94 |
-
return $settings;
|
95 |
}
|
96 |
}
|
97 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Page class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
27 |
parent::__construct( 'submodule' );
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* get_page_formats.
|
32 |
+
*
|
33 |
+
* @version 2.4.7
|
34 |
+
* @since 2.4.7
|
35 |
+
*/
|
36 |
+
function get_page_formats() {
|
37 |
+
$page_formats = array(
|
38 |
+
// ISO 216 A Series + 2 SIS 014711 extensions
|
39 |
+
'A0',
|
40 |
+
'A1',
|
41 |
+
'A2',
|
42 |
+
'A3',
|
43 |
+
'A4',
|
44 |
+
'A5',
|
45 |
+
'A6',
|
46 |
+
'A7',
|
47 |
+
'A8',
|
48 |
+
'A9',
|
49 |
+
'A10',
|
50 |
+
'A11',
|
51 |
+
'A12',
|
52 |
+
// ISO 216 B Series + 2 SIS 014711 extensions
|
53 |
+
'B0',
|
54 |
+
'B1',
|
55 |
+
'B2',
|
56 |
+
'B3',
|
57 |
+
'B4',
|
58 |
+
'B5',
|
59 |
+
'B6',
|
60 |
+
'B7',
|
61 |
+
'B8',
|
62 |
+
'B9',
|
63 |
+
'B10',
|
64 |
+
'B11',
|
65 |
+
'B12',
|
66 |
+
// ISO 216 C Series + 2 SIS 014711 extensions + 2 EXTENSION
|
67 |
+
'C0',
|
68 |
+
'C1',
|
69 |
+
'C2',
|
70 |
+
'C3',
|
71 |
+
'C4',
|
72 |
+
'C5',
|
73 |
+
'C6',
|
74 |
+
'C7',
|
75 |
+
'C8',
|
76 |
+
'C9',
|
77 |
+
'C10',
|
78 |
+
'C11',
|
79 |
+
'C12',
|
80 |
+
'C76',
|
81 |
+
'DL',
|
82 |
+
// SIS 014711 E Series
|
83 |
+
'E0',
|
84 |
+
'E1',
|
85 |
+
'E2',
|
86 |
+
'E3',
|
87 |
+
'E4',
|
88 |
+
'E5',
|
89 |
+
'E6',
|
90 |
+
'E7',
|
91 |
+
'E8',
|
92 |
+
'E9',
|
93 |
+
'E10',
|
94 |
+
'E11',
|
95 |
+
'E12',
|
96 |
+
// SIS 014711 G Series
|
97 |
+
'G0',
|
98 |
+
'G1',
|
99 |
+
'G2',
|
100 |
+
'G3',
|
101 |
+
'G4',
|
102 |
+
'G5',
|
103 |
+
'G6',
|
104 |
+
'G7',
|
105 |
+
'G8',
|
106 |
+
'G9',
|
107 |
+
'G10',
|
108 |
+
'G11',
|
109 |
+
'G12',
|
110 |
+
// ISO Press
|
111 |
+
'RA0',
|
112 |
+
'RA1',
|
113 |
+
'RA2',
|
114 |
+
'RA3',
|
115 |
+
'RA4',
|
116 |
+
'SRA0',
|
117 |
+
'SRA1',
|
118 |
+
'SRA2',
|
119 |
+
'SRA3',
|
120 |
+
'SRA4',
|
121 |
+
// German DIN 476
|
122 |
+
'4A0',
|
123 |
+
'2A0',
|
124 |
+
// Variations on the ISO Standard
|
125 |
+
'A2_EXTRA',
|
126 |
+
'A3+',
|
127 |
+
'A3_EXTRA',
|
128 |
+
'A3_SUPER',
|
129 |
+
'SUPER_A3',
|
130 |
+
'A4_EXTRA',
|
131 |
+
'A4_SUPER',
|
132 |
+
'SUPER_A4',
|
133 |
+
'A4_LONG',
|
134 |
+
'F4',
|
135 |
+
'SO_B5_EXTRA',
|
136 |
+
'A5_EXTRA',
|
137 |
+
// ANSI Series
|
138 |
+
'ANSI_E',
|
139 |
+
'ANSI_D',
|
140 |
+
'ANSI_C',
|
141 |
+
'ANSI_B',
|
142 |
+
'ANSI_A',
|
143 |
+
// Traditional 'Loose' North American Paper Sizes
|
144 |
+
'USLEDGER',
|
145 |
+
'LEDGER',
|
146 |
+
'ORGANIZERK',
|
147 |
+
'BIBLE',
|
148 |
+
'USTABLOID',
|
149 |
+
'TABLOID',
|
150 |
+
'ORGANIZERM',
|
151 |
+
'USLETTER',
|
152 |
+
'LETTER',
|
153 |
+
'USLEGAL',
|
154 |
+
'LEGAL',
|
155 |
+
'GOVERNMENTLETTER',
|
156 |
+
'GLETTER',
|
157 |
+
'JUNIORLEGAL',
|
158 |
+
'JLEGAL',
|
159 |
+
// Other North American Paper Sizes
|
160 |
+
'QUADDEMY',
|
161 |
+
'SUPER_B',
|
162 |
+
'QUARTO',
|
163 |
+
'GOVERNMENTLEGAL',
|
164 |
+
'FOLIO',
|
165 |
+
'MONARCH',
|
166 |
+
'EXECUTIVE',
|
167 |
+
'ORGANIZERL',
|
168 |
+
'STATEMENT',
|
169 |
+
'MEMO',
|
170 |
+
'FOOLSCAP',
|
171 |
+
'COMPACT',
|
172 |
+
'ORGANIZERJ',
|
173 |
+
// Canadian standard CAN 2-9.60M
|
174 |
+
'P1',
|
175 |
+
'P2',
|
176 |
+
'P3',
|
177 |
+
'P4',
|
178 |
+
'P5',
|
179 |
+
'P6',
|
180 |
+
// North American Architectural Sizes
|
181 |
+
'ARCH_E',
|
182 |
+
'ARCH_E1',
|
183 |
+
'ARCH_D',
|
184 |
+
'BROADSHEET',
|
185 |
+
'ARCH_C',
|
186 |
+
'ARCH_B',
|
187 |
+
'ARCH_A',
|
188 |
+
// --- North American Envelope Sizes ---
|
189 |
+
// - Announcement Envelopes
|
190 |
+
'ANNENV_A2',
|
191 |
+
'ANNENV_A6',
|
192 |
+
'ANNENV_A7',
|
193 |
+
'ANNENV_A8',
|
194 |
+
'ANNENV_A10',
|
195 |
+
'ANNENV_SLIM',
|
196 |
+
// - Commercial Envelopes
|
197 |
+
'COMMENV_N6_1/4',
|
198 |
+
'COMMENV_N6_3/4',
|
199 |
+
'COMMENV_N8',
|
200 |
+
'COMMENV_N9',
|
201 |
+
'COMMENV_N10',
|
202 |
+
'COMMENV_N11',
|
203 |
+
'COMMENV_N12',
|
204 |
+
'COMMENV_N14',
|
205 |
+
// - Catalogue Envelopes
|
206 |
+
'CATENV_N1',
|
207 |
+
'CATENV_N1_3/4',
|
208 |
+
'CATENV_N2',
|
209 |
+
'CATENV_N3',
|
210 |
+
'CATENV_N6',
|
211 |
+
'CATENV_N7',
|
212 |
+
'CATENV_N8',
|
213 |
+
'CATENV_N9_1/2',
|
214 |
+
'CATENV_N9_3/4',
|
215 |
+
'CATENV_N10_1/2',
|
216 |
+
'CATENV_N12_1/2',
|
217 |
+
'CATENV_N13_1/2',
|
218 |
+
'CATENV_N14_1/4',
|
219 |
+
'CATENV_N14_1/2',
|
220 |
+
// Japanese (JIS P 0138-61) Standard B-Series
|
221 |
+
'JIS_B0',
|
222 |
+
'JIS_B1',
|
223 |
+
'JIS_B2',
|
224 |
+
'JIS_B3',
|
225 |
+
'JIS_B4',
|
226 |
+
'JIS_B5',
|
227 |
+
'JIS_B6',
|
228 |
+
'JIS_B7',
|
229 |
+
'JIS_B8',
|
230 |
+
'JIS_B9',
|
231 |
+
'JIS_B10',
|
232 |
+
'JIS_B11',
|
233 |
+
'JIS_B12',
|
234 |
+
// PA Series
|
235 |
+
'PA0',
|
236 |
+
'PA1',
|
237 |
+
'PA2',
|
238 |
+
'PA3',
|
239 |
+
'PA4',
|
240 |
+
'PA5',
|
241 |
+
'PA6',
|
242 |
+
'PA7',
|
243 |
+
'PA8',
|
244 |
+
'PA9',
|
245 |
+
'PA10',
|
246 |
+
// Standard Photographic Print Sizes
|
247 |
+
/* 'PASSPORT_PHOTO',
|
248 |
+
'E',
|
249 |
+
'L',
|
250 |
+
'3R',
|
251 |
+
'KG',
|
252 |
+
'4R',
|
253 |
+
'4D',
|
254 |
+
'2L',
|
255 |
+
'5R',
|
256 |
+
'8P',
|
257 |
+
'6R',
|
258 |
+
'6P',
|
259 |
+
'8R',
|
260 |
+
'6PW',
|
261 |
+
'S8R',
|
262 |
+
'4P',
|
263 |
+
'10R',
|
264 |
+
'4PW',
|
265 |
+
'S10R',
|
266 |
+
'11R',
|
267 |
+
'S11R',
|
268 |
+
'12R',
|
269 |
+
'S12R',
|
270 |
+
// Common Newspaper Sizes
|
271 |
+
'NEWSPAPER_BROADSHEET',
|
272 |
+
'NEWSPAPER_BERLINER',
|
273 |
+
'NEWSPAPER_TABLOID',
|
274 |
+
'NEWSPAPER_COMPACT',
|
275 |
+
// Business Cards
|
276 |
+
'CREDIT_CARD',
|
277 |
+
'BUSINESS_CARD',
|
278 |
+
'BUSINESS_CARD_ISO7810',
|
279 |
+
'BUSINESS_CARD_ISO216',
|
280 |
+
'BUSINESS_CARD_IT',
|
281 |
+
'BUSINESS_CARD_UK',
|
282 |
+
'BUSINESS_CARD_FR',
|
283 |
+
'BUSINESS_CARD_DE',
|
284 |
+
'BUSINESS_CARD_ES',
|
285 |
+
'BUSINESS_CARD_CA',
|
286 |
+
'BUSINESS_CARD_US',
|
287 |
+
'BUSINESS_CARD_JP',
|
288 |
+
'BUSINESS_CARD_HK',
|
289 |
+
'BUSINESS_CARD_AU',
|
290 |
+
'BUSINESS_CARD_DK',
|
291 |
+
'BUSINESS_CARD_SE',
|
292 |
+
'BUSINESS_CARD_RU',
|
293 |
+
'BUSINESS_CARD_CZ',
|
294 |
+
'BUSINESS_CARD_FI',
|
295 |
+
'BUSINESS_CARD_HU',
|
296 |
+
'BUSINESS_CARD_IL',
|
297 |
+
// Billboards
|
298 |
+
'4SHEET',
|
299 |
+
'6SHEET',
|
300 |
+
'12SHEET',
|
301 |
+
'16SHEET',
|
302 |
+
'32SHEET',
|
303 |
+
'48SHEET',
|
304 |
+
'64SHEET',
|
305 |
+
'96SHEET',
|
306 |
+
// Old European Sizes
|
307 |
+
// - Old Imperial English Sizes
|
308 |
+
'EN_EMPEROR',
|
309 |
+
'EN_ANTIQUARIAN',
|
310 |
+
'EN_GRAND_EAGLE',
|
311 |
+
'EN_DOUBLE_ELEPHANT',
|
312 |
+
'EN_ATLAS',
|
313 |
+
'EN_COLOMBIER',
|
314 |
+
'EN_ELEPHANT',
|
315 |
+
'EN_DOUBLE_DEMY',
|
316 |
+
'EN_IMPERIAL',
|
317 |
+
'EN_PRINCESS',
|
318 |
+
'EN_CARTRIDGE',
|
319 |
+
'EN_DOUBLE_LARGE_POST',
|
320 |
+
'EN_ROYAL',
|
321 |
+
'EN_SHEET',
|
322 |
+
'EN_HALF_POST',
|
323 |
+
'EN_SUPER_ROYAL',
|
324 |
+
'EN_DOUBLE_POST',
|
325 |
+
'EN_MEDIUM',
|
326 |
+
'EN_DEMY',
|
327 |
+
'EN_LARGE_POST',
|
328 |
+
'EN_COPY_DRAUGHT',
|
329 |
+
'EN_POST',
|
330 |
+
'EN_CROWN',
|
331 |
+
'EN_PINCHED_POST',
|
332 |
+
'EN_BRIEF',
|
333 |
+
'EN_FOOLSCAP',
|
334 |
+
'EN_SMALL_FOOLSCAP',
|
335 |
+
'EN_POTT',
|
336 |
+
// - Old Imperial Belgian Sizes
|
337 |
+
'BE_GRAND_AIGLE',
|
338 |
+
'BE_COLOMBIER',
|
339 |
+
'BE_DOUBLE_CARRE',
|
340 |
+
'BE_ELEPHANT',
|
341 |
+
'BE_PETIT_AIGLE',
|
342 |
+
'BE_GRAND_JESUS',
|
343 |
+
'BE_JESUS',
|
344 |
+
'BE_RAISIN',
|
345 |
+
'BE_GRAND_MEDIAN',
|
346 |
+
'BE_DOUBLE_POSTE',
|
347 |
+
'BE_COQUILLE',
|
348 |
+
'BE_PETIT_MEDIAN',
|
349 |
+
'BE_RUCHE',
|
350 |
+
'BE_PROPATRIA',
|
351 |
+
'BE_LYS',
|
352 |
+
'BE_POT',
|
353 |
+
'BE_ROSETTE',
|
354 |
+
// - Old Imperial French Sizes
|
355 |
+
'FR_UNIVERS',
|
356 |
+
'FR_DOUBLE_COLOMBIER',
|
357 |
+
'FR_GRANDE_MONDE',
|
358 |
+
'FR_DOUBLE_SOLEIL',
|
359 |
+
'FR_DOUBLE_JESUS',
|
360 |
+
'FR_GRAND_AIGLE',
|
361 |
+
'FR_PETIT_AIGLE',
|
362 |
+
'FR_DOUBLE_RAISIN',
|
363 |
+
'FR_JOURNAL',
|
364 |
+
'FR_COLOMBIER_AFFICHE',
|
365 |
+
'FR_DOUBLE_CAVALIER',
|
366 |
+
'FR_CLOCHE',
|
367 |
+
'FR_SOLEIL',
|
368 |
+
'FR_DOUBLE_CARRE',
|
369 |
+
'FR_DOUBLE_COQUILLE',
|
370 |
+
'FR_JESUS',
|
371 |
+
'FR_RAISIN',
|
372 |
+
'FR_CAVALIER',
|
373 |
+
'FR_DOUBLE_COURONNE',
|
374 |
+
'FR_CARRE',
|
375 |
+
'FR_COQUILLE',
|
376 |
+
'FR_DOUBLE_TELLIERE',
|
377 |
+
'FR_DOUBLE_CLOCHE',
|
378 |
+
'FR_DOUBLE_POT',
|
379 |
+
'FR_ECU',
|
380 |
+
'FR_COURONNE',
|
381 |
+
'FR_TELLIERE',
|
382 |
+
'FR_POT', */
|
383 |
+
);
|
384 |
+
|
385 |
+
$page_formats_options = array();
|
386 |
+
foreach ( $page_formats as $page_format ) {
|
387 |
+
$page_formats_options[ $page_format ] = $page_format;
|
388 |
+
}
|
389 |
+
return $page_formats_options;
|
390 |
+
}
|
391 |
+
|
392 |
/**
|
393 |
* get_settings.
|
394 |
*
|
395 |
+
* @version 2.4.7
|
396 |
*/
|
397 |
function get_settings() {
|
398 |
$settings = array();
|
|
|
|
|
|
|
|
|
399 |
$invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
|
400 |
foreach ( $invoice_types as $invoice_type ) {
|
401 |
$settings[] = array(
|
418 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_page_format',
|
419 |
'default' => 'A4',
|
420 |
'type' => 'select',
|
421 |
+
'options' => $this->get_page_formats(),
|
422 |
);
|
423 |
$settings[] = array(
|
424 |
'title' => __( 'Margin Left', 'woocommerce-jetpack' ),
|
449 |
'id' => 'wcj_invoicing_' . $invoice_type['id'] . '_page_options',
|
450 |
);
|
451 |
}
|
452 |
+
return $this->add_standard_settings( $settings );
|
453 |
}
|
454 |
}
|
455 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-styling.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Styling class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -30,7 +30,7 @@ class WCJ_PDF_Invoicing_Styling extends WCJ_Module {
|
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
-
* @version 2.4.
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
|
@@ -93,7 +93,7 @@ class WCJ_PDF_Invoicing_Styling extends WCJ_Module {
|
|
93 |
);
|
94 |
}
|
95 |
|
96 |
-
return $settings;
|
97 |
}
|
98 |
}
|
99 |
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoicing Styling class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
+
* @version 2.4.7
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
|
93 |
);
|
94 |
}
|
95 |
|
96 |
+
return $this->add_standard_settings( $settings );
|
97 |
}
|
98 |
}
|
99 |
|
includes/pdf-invoices/settings/class-wcj-pdf-invoicing-templates.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Templates class.
|
6 |
*
|
7 |
-
* @version 2.4.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -30,7 +30,7 @@ class WCJ_PDF_Invoicing_Templates extends WCJ_Module {
|
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
-
* @version 2.4.
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
|
@@ -72,7 +72,7 @@ class WCJ_PDF_Invoicing_Templates extends WCJ_Module {
|
|
72 |
'id' => 'wcj_invoicing_templates_desc',
|
73 |
);
|
74 |
|
75 |
-
return $settings;
|
76 |
}
|
77 |
|
78 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack PDF Invoices Templates class.
|
6 |
*
|
7 |
+
* @version 2.4.7
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
30 |
/**
|
31 |
* get_settings.
|
32 |
*
|
33 |
+
* @version 2.4.7
|
34 |
*/
|
35 |
function get_settings() {
|
36 |
|
72 |
'id' => 'wcj_invoicing_templates_desc',
|
73 |
);
|
74 |
|
75 |
+
return $this->add_standard_settings( $settings );
|
76 |
}
|
77 |
|
78 |
}
|
includes/reports/countries/wcj-country-sets.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
/**
|
3 |
* WooCommerce Jetpack Country Sets
|
4 |
*
|
5 |
-
* @version
|
6 |
-
* @author
|
7 |
*/
|
8 |
-
|
9 |
return array(
|
10 |
|
11 |
'Africa' => array(
|
@@ -21,7 +21,7 @@ return array(
|
|
21 |
),
|
22 |
'Europe' => array(
|
23 |
'AD', 'AL', 'AT', 'AX', 'BA', 'BE', 'BG', 'BY', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'FX', 'GB', 'GG', 'GI', 'GR', 'HR', 'HU', 'IE', 'IM', 'IS', 'IT', 'JE', 'LI', 'LT', 'LU', 'LV', 'MC', 'MD', 'ME', 'MK', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'RU', 'SE', 'SI', 'SJ', 'SK', 'SM', 'TR', 'UA', 'VA',
|
24 |
-
),
|
25 |
/*'Europe excl EU' => array(
|
26 |
'AD', 'AL', 'AX', 'BA', 'BY', 'CH', 'FO', 'FX', 'GG', 'GI', 'IM', 'IS', 'JE', 'LI', 'MC', 'MD', 'ME', 'MK', 'NO', 'RS', 'RU', 'SJ', 'SM', 'TR', 'UA', 'VA',
|
27 |
),*/
|
@@ -42,4 +42,8 @@ return array(
|
|
42 |
'AR', 'BO', 'BR', 'CL', 'CO', 'EC', 'FK', 'GF', 'GY', 'GY', 'PE', 'PY', 'SR', 'UY', 'VE',
|
43 |
),
|
44 |
|
|
|
|
|
|
|
|
|
45 |
);
|
2 |
/**
|
3 |
* WooCommerce Jetpack Country Sets
|
4 |
*
|
5 |
+
* @version 2.4.7
|
6 |
+
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
+
|
9 |
return array(
|
10 |
|
11 |
'Africa' => array(
|
21 |
),
|
22 |
'Europe' => array(
|
23 |
'AD', 'AL', 'AT', 'AX', 'BA', 'BE', 'BG', 'BY', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'FX', 'GB', 'GG', 'GI', 'GR', 'HR', 'HU', 'IE', 'IM', 'IS', 'IT', 'JE', 'LI', 'LT', 'LU', 'LV', 'MC', 'MD', 'ME', 'MK', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'RU', 'SE', 'SI', 'SJ', 'SK', 'SM', 'TR', 'UA', 'VA',
|
24 |
+
),
|
25 |
/*'Europe excl EU' => array(
|
26 |
'AD', 'AL', 'AX', 'BA', 'BY', 'CH', 'FO', 'FX', 'GG', 'GI', 'IM', 'IS', 'JE', 'LI', 'MC', 'MD', 'ME', 'MK', 'NO', 'RS', 'RU', 'SJ', 'SM', 'TR', 'UA', 'VA',
|
27 |
),*/
|
42 |
'AR', 'BO', 'BR', 'CL', 'CO', 'EC', 'FK', 'GF', 'GY', 'GY', 'PE', 'PY', 'SR', 'UY', 'VE',
|
43 |
),
|
44 |
|
45 |
+
'Antarctica' => array(
|
46 |
+
'AQ',
|
47 |
+
),
|
48 |
+
|
49 |
);
|
includes/reports/wcj-class-reports-monthly-sales.php
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Jetpack Mothly Sales Reports
|
4 |
+
*
|
5 |
+
* The WooCommerce Jetpack Mothly Sales Reports class.
|
6 |
+
*
|
7 |
+
* @version 2.4.7
|
8 |
+
* @since 2.4.7
|
9 |
+
* @author Algoritmika Ltd.
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'WCJ_Reports_Monthly_Sales' ) ) :
|
15 |
+
|
16 |
+
class WCJ_Reports_Monthly_Sales {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor.
|
20 |
+
*
|
21 |
+
* @version 2.4.7
|
22 |
+
* @since 2.4.7
|
23 |
+
*/
|
24 |
+
public function __construct( $args = null ) {
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* get_report.
|
30 |
+
*
|
31 |
+
* @version 2.4.7
|
32 |
+
* @since 2.4.7
|
33 |
+
*/
|
34 |
+
public function get_report() {
|
35 |
+
$html = '';
|
36 |
+
$this->year = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
|
37 |
+
$html .= $this->get_monthly_sales_report();
|
38 |
+
return $html;
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* get_exchange_rate_average.
|
43 |
+
*
|
44 |
+
* @version 2.4.7
|
45 |
+
* @since 2.4.7
|
46 |
+
*/
|
47 |
+
function get_exchange_rate_average( $currency_from, $currency_to, $start_date, $end_date ) {
|
48 |
+
if ( $currency_from == $currency_to ) {
|
49 |
+
return 1.0;
|
50 |
+
}
|
51 |
+
if ( 'USD' != $currency_from ) {
|
52 |
+
// USD/$currency_from
|
53 |
+
$url = 'https://query.yahooapis.com/v1/public/yql?q=select%20Close%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22'
|
54 |
+
. $currency_from . '%3DX%22%20and%20startDate%20%3D%20%22'
|
55 |
+
. $start_date . '%22%20and%20endDate%20%3D%20%22'
|
56 |
+
. $end_date. '%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=';
|
57 |
+
ob_start();
|
58 |
+
$max_execution_time = ini_get( 'max_execution_time' );
|
59 |
+
set_time_limit( 2 );
|
60 |
+
$exchange_rate = json_decode( file_get_contents( $url ) );
|
61 |
+
set_time_limit( $max_execution_time );
|
62 |
+
ob_end_clean();
|
63 |
+
if ( ! isset( $exchange_rate->query->results->quote ) || count( $exchange_rate->query->results->quote ) < 1 ) {
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
$average_currency_from = 0;
|
67 |
+
foreach ( $exchange_rate->query->results->quote as $quote ) {
|
68 |
+
$average_currency_from += $quote->Close;
|
69 |
+
}
|
70 |
+
$average_currency_from = $average_currency_from / count( $exchange_rate->query->results->quote );
|
71 |
+
} else {
|
72 |
+
$average_currency_from = 1.0;
|
73 |
+
}
|
74 |
+
if ( 'USD' != $currency_to ) {
|
75 |
+
// USD/$currency_to
|
76 |
+
$url = 'https://query.yahooapis.com/v1/public/yql?q=select%20Close%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22'
|
77 |
+
. $currency_to . '%3DX%22%20and%20startDate%20%3D%20%22'
|
78 |
+
. $start_date . '%22%20and%20endDate%20%3D%20%22'
|
79 |
+
. $end_date. '%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=';
|
80 |
+
ob_start();
|
81 |
+
$max_execution_time = ini_get( 'max_execution_time' );
|
82 |
+
set_time_limit( 2 );
|
83 |
+
$exchange_rate = json_decode( file_get_contents( $url ) );
|
84 |
+
set_time_limit( $max_execution_time );
|
85 |
+
ob_end_clean();
|
86 |
+
if ( ! isset( $exchange_rate->query->results->quote ) || count( $exchange_rate->query->results->quote ) < 1 ) {
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
$average_currency_to = 0;
|
90 |
+
foreach ( $exchange_rate->query->results->quote as $quote ) {
|
91 |
+
$average_currency_to += $quote->Close;
|
92 |
+
}
|
93 |
+
$average_currency_to = $average_currency_to / count( $exchange_rate->query->results->quote );
|
94 |
+
} else {
|
95 |
+
$average_currency_to = 1.0;
|
96 |
+
}
|
97 |
+
return $average_currency_to / $average_currency_from;
|
98 |
+
}
|
99 |
+
|
100 |
+
/*
|
101 |
+
* get_monthly_sales_report.
|
102 |
+
*
|
103 |
+
* @version 2.4.7
|
104 |
+
* @since 2.4.7
|
105 |
+
*/
|
106 |
+
function get_monthly_sales_report() {
|
107 |
+
$block_size = 96;
|
108 |
+
$table_data = array();
|
109 |
+
$months_array = array( '' );
|
110 |
+
$total_orders_array = array( __( 'Total Orders', 'woocommerce-jetpack' ) );
|
111 |
+
$total_orders_sum_array = array( __( 'Total Sum', 'woocommerce-jetpack' ) . '<br>' . __( 'Total Sum (excl. TAX)', 'woocommerce-jetpack' ) );
|
112 |
+
$order_currencies_array = array(); // TODO
|
113 |
+
$report_currency = ( isset( $_GET['currency'] ) && 'merge' != $_GET['currency'] ) ? $_GET['currency'] : get_woocommerce_currency();
|
114 |
+
for ( $i = 1; $i <= 12; $i++ ) {
|
115 |
+
$current_months_averages = array();
|
116 |
+
$total_orders = 0;
|
117 |
+
$total_orders_sum = 0;
|
118 |
+
$total_orders_sum_excl_tax = 0;
|
119 |
+
$offset = 0;
|
120 |
+
while( true ) {
|
121 |
+
$args_orders = array(
|
122 |
+
'post_type' => 'shop_order',
|
123 |
+
'post_status' => 'wc-completed',
|
124 |
+
'posts_per_page' => $block_size,
|
125 |
+
'orderby' => 'date',
|
126 |
+
'order' => 'DESC',
|
127 |
+
'offset' => $offset,
|
128 |
+
'date_query' => array(
|
129 |
+
array(
|
130 |
+
'year' => $this->year,
|
131 |
+
'month' => $i,
|
132 |
+
),
|
133 |
+
),
|
134 |
+
);
|
135 |
+
$loop_orders = new WP_Query( $args_orders );
|
136 |
+
if ( ! $loop_orders->have_posts() ) break;
|
137 |
+
while ( $loop_orders->have_posts() ) : $loop_orders->the_post();
|
138 |
+
$order_id = $loop_orders->post->ID;
|
139 |
+
$order = new WC_Order( $order_id );
|
140 |
+
$order_currency = $order->get_order_currency();
|
141 |
+
if ( ! isset( $order_currencies_array[ $order_currency ] ) ) {
|
142 |
+
$order_currencies_array[ $order_currency ] = 0;
|
143 |
+
}
|
144 |
+
$order_currencies_array[ $order_currency ]++;
|
145 |
+
$total_orders++;
|
146 |
+
$order_total = $order->get_total();
|
147 |
+
$order_total_excl_tax = $order->get_total() - $order->get_total_tax();
|
148 |
+
if ( ! isset( $current_months_averages[ $order_currency ][ $report_currency ] ) ) {
|
149 |
+
$start_date = $this->year . '-' . sprintf( '%02d', $i ) . '-'. '01';
|
150 |
+
$end_date = date( 'Y-m-t', strtotime( $start_date ) );
|
151 |
+
$current_months_averages[ $order_currency ][ $report_currency ] = $this->get_exchange_rate_average(
|
152 |
+
$order_currency,
|
153 |
+
$report_currency,
|
154 |
+
$start_date,
|
155 |
+
$end_date
|
156 |
+
);
|
157 |
+
// TODO: take not monthly average, but "Close" of closest day
|
158 |
+
}
|
159 |
+
$total_orders_sum += $order_total * $current_months_averages[ $order_currency ][ $report_currency ];
|
160 |
+
$total_orders_sum_excl_tax += $order_total_excl_tax * $current_months_averages[ $order_currency ][ $report_currency ];
|
161 |
+
endwhile;
|
162 |
+
$offset += $block_size;
|
163 |
+
}
|
164 |
+
$months_array[] = date_i18n( 'F', mktime( 0, 0, 0, $i, 10 ) )/* . '[' . $start_date . ' ~ ' . $end_date . ']' */;
|
165 |
+
$total_orders_array[] = $total_orders;
|
166 |
+
|
167 |
+
$total_orders_result_html = $report_currency . ' ' . number_format( $total_orders_sum, 2, '.', ',' );
|
168 |
+
//if ( $total_orders_sum != $total_orders_sum_excl_tax) {
|
169 |
+
$total_orders_result_html .= '<br>' . $report_currency . ' ' . number_format( $total_orders_sum_excl_tax, 2, '.', ',' );
|
170 |
+
//}
|
171 |
+
/* $total_orders_result_html .= '<br>' . $report_currency . ' ' . number_format( $total_orders_sum_excl_tax * 0.965, 2, '.', ',' ); // TODO !!!;
|
172 |
+
$total_orders_result_html .= '<br>' . $report_currency . ' ' . number_format( $total_orders_sum_excl_tax * 0.965 * 0.80, 2, '.', ',' ); // TODO !!!; */
|
173 |
+
if ( isset( $_GET['show_rates'] ) ) { // TODO
|
174 |
+
ksort( $current_months_averages, true );
|
175 |
+
// $total_orders_result_html .= '<pre style="font-size:8px;">' . print_r( $current_months_averages, true ) . '</pre>';
|
176 |
+
$total_orders_result_html .= '<pre style="font-size:x-small;">';
|
177 |
+
foreach ( $current_months_averages as $currency_from => $currencies_to ) {
|
178 |
+
foreach ( $currencies_to as $currency_to => $rate ) {
|
179 |
+
$total_orders_result_html .= $currency_from . $currency_to . '~' . number_format( $rate, 4 ) . '<br>';
|
180 |
+
}
|
181 |
+
}
|
182 |
+
$total_orders_result_html .= '</pre>';
|
183 |
+
}
|
184 |
+
$total_orders_sum_array[] = $total_orders_result_html;
|
185 |
+
}
|
186 |
+
$table_data[] = $months_array;
|
187 |
+
$table_data[] = $total_orders_array;
|
188 |
+
$table_data[] = $total_orders_sum_array;
|
189 |
+
/* foreach ( $order_currencies_array as $order_currency => $total_currency_orders ) {
|
190 |
+
$table_data[] = array( $order_currency . ' (' . $total_currency_orders . ')' );
|
191 |
+
} */
|
192 |
+
$html = '';
|
193 |
+
$menu = '';
|
194 |
+
$menu .= '<ul class="subsubsub">';
|
195 |
+
$menu .= '<li><a href="' . add_query_arg( 'year', date( 'Y' ) ) . '" class="' . ( ( $this->year == date( 'Y' ) ) ? 'current' : '' ) . '">' . date( 'Y' ) . '</a> | </li>';
|
196 |
+
$menu .= '<li><a href="' . add_query_arg( 'year', ( date( 'Y' ) - 1 ) ) . '" class="' . ( ( $this->year == ( date( 'Y' ) - 1 ) ) ? 'current' : '' ) . '">' . ( date( 'Y' ) - 1 ) . '</a> | </li>';
|
197 |
+
$menu .= '</ul>';
|
198 |
+
$menu .= '<br class="clear">';
|
199 |
+
$html .= $menu;
|
200 |
+
$html .= '<h4>' . __( 'Report currency', 'woocommerce-jetpack' ) . ': ' . $report_currency . '</h4>';
|
201 |
+
$html .= wcj_get_table_html( $table_data, array(
|
202 |
+
'table_class' => 'widefat striped',
|
203 |
+
'table_heading_type' => 'horizontal',
|
204 |
+
'columns_styles' => array(
|
205 |
+
'width:16%;',
|
206 |
+
'width:7%;',
|
207 |
+
'width:7%;',
|
208 |
+
'width:7%;',
|
209 |
+
'width:7%;',
|
210 |
+
'width:7%;',
|
211 |
+
'width:7%;',
|
212 |
+
'width:7%;',
|
213 |
+
'width:7%;',
|
214 |
+
'width:7%;',
|
215 |
+
'width:7%;',
|
216 |
+
'width:7%;',
|
217 |
+
'width:7%;',
|
218 |
+
),
|
219 |
+
) );
|
220 |
+
return $html;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
endif;
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Booster for WooCommerce ===
|
2 |
Contributors: algoritmika,anbinder,solovjov
|
3 |
Tags: woocommerce,booster for 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,vat,gateway by country,price by country,currency switcher
|
4 |
-
Requires at least:
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.4.
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -120,6 +120,35 @@ To unlock all Booster for WooCommerce features, please install additional [Boost
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
= 2.4.6 - 07/04/2016 =
|
124 |
* Dev - Documentation link added to `WCJ_Module` class.
|
125 |
* Dev - Functions - `wcj_current_filter_priority()` function added (affected Checkout Files Upload module).
|
1 |
=== Booster for WooCommerce ===
|
2 |
Contributors: algoritmika,anbinder,solovjov
|
3 |
Tags: woocommerce,booster for 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,vat,gateway by country,price by country,currency switcher
|
4 |
+
Requires at least: 4.1
|
5 |
+
Tested up to: 4.5
|
6 |
+
Stable tag: 2.4.7
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 2.4.7 - 19/04/2016 =
|
124 |
+
* Dev - Fixing plugin's performance issue - Version (`booster_for_woocommerce_version`) parameter added.
|
125 |
+
* Dev - `source` parameter added to documentation link (module and dashboard).
|
126 |
+
* Fix - PRODUCTS - Product Input Fields - File type field - Admin order view (order details) - Check for not empty file name added.
|
127 |
+
* Dev - PRODUCTS - Product Input Fields - Datepicker/Weekpicker - Year selector and year range options added.
|
128 |
+
* Dev - PRODUCTS - Product Tabs - Product edit metabox renamed.
|
129 |
+
* Dev - PRODUCTS - Product Tabs - Per product tabs - Styling (in admin product edit) changed.
|
130 |
+
* Dev - PRODUCTS - Product Tabs - Per product tabs - Default title/priority/content/conditional visibility by products/categories/tags options added.
|
131 |
+
* Fix - CART & CHECKOUT - Checkout Files Upload - Fixed wrong "is required" validation when field is disabled.
|
132 |
+
* Dev - CART & CHECKOUT - Checkout Files Upload - Settings field type changed from `text` to `textarea` (in all notice and main label fields).
|
133 |
+
* Dev - CART & CHECKOUT - Checkout Files Upload - Files info added to order details and emails.
|
134 |
+
* Dev - CART & CHECKOUT - Checkout Files Upload - Conditional visibility by products/categories/tags options added.
|
135 |
+
* Fix - CART & CHECKOUT - Checkout Custom Fields - Name instead of value in order details and admin order view for select and radio type fields.
|
136 |
+
* Dev - CART & CHECKOUT - Checkout Custom Fields - Datepicker/Weekpicker - Year selector and year range options added.
|
137 |
+
* Dev - CART & CHECKOUT - Checkout Custom Fields - Documentation link added.
|
138 |
+
* Fix - CART & CHECKOUT - Checkout Custom Info - Priority bug fixed.
|
139 |
+
* Dev - CART & CHECKOUT - Checkout Custom Info - Documentation link added. Reset button added.
|
140 |
+
* Fix - PAYMENT GATEWAYS - Gateways per Product or Category - Additional check added in `filter_available_payment_gateways_per_category` function. This is fixing compatibility issue with "WooCommerce Subscriptions" plugin.
|
141 |
+
* Dev - PAYMENT GATEWAYS - Gateways per Product or Category - Documentation link added. Reset button added.
|
142 |
+
* Dev - PDF INVOICING & PACKING SLIPS - Reset buttons added to all submodules.
|
143 |
+
* Dev - PDF INVOICING & PACKING SLIPS - Documentation link added.
|
144 |
+
* Dev - PDF INVOICING & PACKING SLIPS - Display & Misc. - "Actions" buttons added (and column buttons removed).
|
145 |
+
* Dev - PDF INVOICING & PACKING SLIPS - Page Settings - Page Format - Options added.
|
146 |
+
* Dev - PDF INVOICING & PACKING SLIPS - "Invoices Report" tool - Buttons renamed.
|
147 |
+
* Dev - EMAILS & MISC. - EU VAT Number - Unnecessary `woocommerce_checkout_update_order_meta` filter function removed.
|
148 |
+
* Dev - EMAILS & MISC. - EU VAT Number - VAT number info added to order details and emails.
|
149 |
+
* Dev - EMAILS & MISC. - Reports - "Available Reports" section in admin's settings modified.
|
150 |
+
* Dev - EMAILS & MISC. - Reports - "Booster: Monthly Sales" added.
|
151 |
+
|
152 |
= 2.4.6 - 07/04/2016 =
|
153 |
* Dev - Documentation link added to `WCJ_Module` class.
|
154 |
* Dev - Functions - `wcj_current_filter_priority()` function added (affected Checkout Files Upload module).
|
woocommerce-jetpack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: http://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
-
Version: 2.4.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2016 Algoritmika Ltd.
|
@@ -21,11 +21,19 @@ if ( ! class_exists( 'WC_Jetpack' ) ) :
|
|
21 |
* Main WC_Jetpack Class
|
22 |
*
|
23 |
* @class WC_Jetpack
|
24 |
-
* @version 2.4.
|
25 |
*/
|
26 |
|
27 |
final class WC_Jetpack {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* @var WC_Jetpack The single instance of the class
|
31 |
*/
|
@@ -395,7 +403,7 @@ final class WC_Jetpack {
|
|
395 |
/**
|
396 |
* Include modules and submodules
|
397 |
*
|
398 |
-
* @version 2.4.
|
399 |
*/
|
400 |
private function include_modules() {
|
401 |
$settings = array();
|
@@ -466,25 +474,34 @@ final class WC_Jetpack {
|
|
466 |
|
467 |
// Add options
|
468 |
if ( is_admin() ) {
|
469 |
-
foreach ( $settings as $section ) {
|
470 |
|
471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
-
// Modules statuses
|
474 |
-
$submodules_classes = array(
|
475 |
-
'WCJ_PDF_Invoicing_Display',
|
476 |
-
'WCJ_PDF_Invoicing_Emails',
|
477 |
-
'WCJ_PDF_Invoicing_Footer',
|
478 |
-
'WCJ_PDF_Invoicing_Header',
|
479 |
-
'WCJ_PDF_Invoicing_Numbering',
|
480 |
-
'WCJ_PDF_Invoicing_Page',
|
481 |
-
'WCJ_PDF_Invoicing_Styling',
|
482 |
-
'WCJ_PDF_Invoicing_Templates',
|
483 |
-
);
|
484 |
if ( ! in_array( get_class( $section ), $submodules_classes ) ) {
|
485 |
-
$this->module_statuses[] = $values[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
487 |
|
|
|
|
|
488 |
// Adding options
|
489 |
foreach ( $values as $value ) {
|
490 |
if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
|
@@ -507,6 +524,10 @@ final class WC_Jetpack {
|
|
507 |
}
|
508 |
}
|
509 |
}
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
}
|
512 |
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: http://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
+
Version: 2.4.7
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Copyright: © 2016 Algoritmika Ltd.
|
21 |
* Main WC_Jetpack Class
|
22 |
*
|
23 |
* @class WC_Jetpack
|
24 |
+
* @version 2.4.7
|
25 |
*/
|
26 |
|
27 |
final class WC_Jetpack {
|
28 |
|
29 |
+
/**
|
30 |
+
* WooCommerce Jetpack version.
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
* @since 2.4.7
|
34 |
+
*/
|
35 |
+
public $version = '2.4.7';
|
36 |
+
|
37 |
/**
|
38 |
* @var WC_Jetpack The single instance of the class
|
39 |
*/
|
403 |
/**
|
404 |
* Include modules and submodules
|
405 |
*
|
406 |
+
* @version 2.4.7
|
407 |
*/
|
408 |
private function include_modules() {
|
409 |
$settings = array();
|
474 |
|
475 |
// Add options
|
476 |
if ( is_admin() ) {
|
|
|
477 |
|
478 |
+
// Modules statuses
|
479 |
+
$submodules_classes = array(
|
480 |
+
'WCJ_PDF_Invoicing_Display',
|
481 |
+
'WCJ_PDF_Invoicing_Emails',
|
482 |
+
'WCJ_PDF_Invoicing_Footer',
|
483 |
+
'WCJ_PDF_Invoicing_Header',
|
484 |
+
'WCJ_PDF_Invoicing_Numbering',
|
485 |
+
'WCJ_PDF_Invoicing_Page',
|
486 |
+
'WCJ_PDF_Invoicing_Styling',
|
487 |
+
'WCJ_PDF_Invoicing_Templates',
|
488 |
+
);
|
489 |
+
|
490 |
+
foreach ( $settings as $section ) {
|
491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
if ( ! in_array( get_class( $section ), $submodules_classes ) ) {
|
493 |
+
// $this->module_statuses[] = $values[1];
|
494 |
+
$status_settings = $section->add_enable_module_setting( array() );
|
495 |
+
$this->module_statuses[] = $status_settings[1];
|
496 |
+
}
|
497 |
+
|
498 |
+
// if ( ! $section->is_enabled() && ! isset ( $_GET['woojetpack_admin_options_reset'] ) ) {
|
499 |
+
if ( get_option( 'booster_for_woocommerce_version' ) === $this->version && ! isset ( $_GET['woojetpack_admin_options_reset'] ) ) {
|
500 |
+
continue;
|
501 |
}
|
502 |
|
503 |
+
$values = $section->get_settings();
|
504 |
+
|
505 |
// Adding options
|
506 |
foreach ( $values as $value ) {
|
507 |
if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
|
524 |
}
|
525 |
}
|
526 |
}
|
527 |
+
|
528 |
+
if ( get_option( 'booster_for_woocommerce_version' ) !== $this->version ) {
|
529 |
+
update_option( 'booster_for_woocommerce_version', $this->version );
|
530 |
+
}
|
531 |
}
|
532 |
}
|
533 |
|