diff --git a/includes/class-aftership-actions.php b/includes/class-aftership-actions.php index ab14726..8e88217 100644 --- a/includes/class-aftership-actions.php +++ b/includes/class-aftership-actions.php @@ -987,6 +987,7 @@ public function show_notices() { 'plugin-install', 'shop_order', 'edit-shop_order', + 'woocommerce_page_wc-orders', ); if ( ! in_array( $screen, $pages_with_tip ) ) { return; diff --git a/includes/class-aftership-settings.php b/includes/class-aftership-settings.php index bacb3a2..76978c0 100644 --- a/includes/class-aftership-settings.php +++ b/includes/class-aftership-settings.php @@ -129,6 +129,14 @@ public function page_init() { 'aftership_setting_section_id' ); + add_settings_field( + 'enable_import_tracking', + '', + array( $this, 'enable_import_tracking_callback' ), + 'aftership-setting-admin', + 'aftership_setting_section_id' + ); + add_settings_field( $this->dom_id_show_order_actions, '', @@ -164,7 +172,9 @@ public function sanitize( $input ) { } if ( isset( $input['enable_import_tracking'] ) ) { - $new_input['enable_import_tracking'] = intval( $input['enable_import_tracking'] ); + if ($input['enable_import_tracking'] == 'on' || $input['enable_import_tracking'] === true || intval($input['enable_import_tracking']) === 1 ) { + $new_input['enable_import_tracking'] = 1; + } } if ( isset( $input['show_orders_actions'] ) ) { @@ -212,9 +222,6 @@ public function couriers_callback() { if ( isset( $this->options['connected'] ) ) { echo ''; } - if ( isset( $this->options['enable_import_tracking'] ) ) { - echo ''; - } } /** @@ -227,6 +234,16 @@ public function custom_domain_callback() { ); } + /** + * Call this func before shown on pages. + */ + public function enable_import_tracking_callback() { + printf( + '
Enable CSV Tracking Import
', + ( isset( $this->options['enable_import_tracking'] ) && 1 === $this->options['enable_import_tracking'] ) ? 'checked="checked"' : '' + ); + } + /** * Call this func before shown on pages. */