Version Description
- Enhancement - Added TrackShip menu inside Shipment Tracking if TrackShip not connected
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 3.2.4.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.4 to 3.2.4.1
- assets/css/admin.css +1 -1
- assets/css/trackship.css +1 -3
- assets/js/shipping_row.js +0 -26
- includes/ast-pro.php +728 -0
- includes/class-wc-advanced-shipment-tracking-admin-notice.php +1 -1
- includes/class-wc-advanced-shipment-tracking-admin.php +28 -11
- includes/class-wc-advanced-shipment-tracking-trackship.php +3 -2
- includes/views/admin_options_trackship_integration.php +25 -21
- readme.txt +3 -0
- woocommerce-advanced-shipment-tracking.php +2 -2
assets/css/admin.css
CHANGED
@@ -386,7 +386,7 @@ input.tab_input_1:checked + label{
|
|
386 |
.tab_inner_container h4 {
|
387 |
margin-top: 0;
|
388 |
}
|
389 |
-
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3, #tab4:checked ~ #content4, #tab5:checked ~ #content5, #tab6:checked ~ #content6, #tab7:checked ~ #content7, #tab8:checked ~ #content8, #tab9:checked ~ #content9, #tab10:checked ~ #content10,#tab_trackship_dashboard:checked ~ #content_trackship_dashboard,#tab_trackship_settings:checked ~ #content_trackship_settings,#tab_tracking_page:checked ~ #content_tracking_page,#tab_status_notifications:checked ~ #content_status_notifications,#tab_tools:checked ~ #content_tools, #tab_license:checked ~ #content_tab_license, #tab_addons:checked ~ #content_tab_addons, #tab_osm:checked ~ #content_osm, #trackship_tab:checked ~ #content_trackship_dashboard {
|
390 |
display: block !important;
|
391 |
}
|
392 |
#tab_email_notifications:checked ~ .shipment-status-email-section,#tab_sms_notifications:checked ~ .shipment-status-sms-section{
|
386 |
.tab_inner_container h4 {
|
387 |
margin-top: 0;
|
388 |
}
|
389 |
+
#tab1:checked ~ #content1, #tab2:checked ~ #content2, #tab3:checked ~ #content3, #tab4:checked ~ #content4, #tab5:checked ~ #content5, #tab6:checked ~ #content6, #tab7:checked ~ #content7, #tab8:checked ~ #content8, #tab9:checked ~ #content9, #tab10:checked ~ #content10,#tab_trackship_dashboard:checked ~ #content_trackship_dashboard,#tab_trackship_settings:checked ~ #content_trackship_settings,#tab_tracking_page:checked ~ #content_tracking_page,#tab_status_notifications:checked ~ #content_status_notifications,#tab_tools:checked ~ #content_tools, #tab_license:checked ~ #content_tab_license, #tab_addons:checked ~ #content_tab_addons, #tab_osm:checked ~ #content_osm, #trackship_tab:checked ~ #content_trackship_dashboard, #trackship:checked ~ #trackship_landing {
|
390 |
display: block !important;
|
391 |
}
|
392 |
#tab_email_notifications:checked ~ .shipment-status-email-section,#tab_sms_notifications:checked ~ .shipment-status-sms-section{
|
assets/css/trackship.css
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
.trackship_section {
|
2 |
-
background: #fff;
|
3 |
-
border: 1px solid #e0e0e0;
|
4 |
border-radius: 3px;
|
5 |
padding: 30px;
|
6 |
margin-top: 30px;
|
1 |
+
.trackship_section {
|
|
|
|
|
2 |
border-radius: 3px;
|
3 |
padding: 30px;
|
4 |
margin-top: 30px;
|
assets/js/shipping_row.js
CHANGED
@@ -347,32 +347,6 @@ jQuery(document).on("click", ".csv_upload_again", function(){
|
|
347 |
jQuery('.csv_error_details_ul li').remove();
|
348 |
});
|
349 |
|
350 |
-
jQuery(document).on("change", "#wcast_enable_late_shipments_admin_email", function(){
|
351 |
-
if(jQuery(this).prop("checked") == true){
|
352 |
-
var wcast_enable_late_shipments_email = 1;
|
353 |
-
}
|
354 |
-
var id = jQuery(this).attr('id');
|
355 |
-
var settings_data = jQuery(this).data("settings");
|
356 |
-
var ajax_data = {
|
357 |
-
action: 'update_enable_late_shipments_email',
|
358 |
-
id: id,
|
359 |
-
wcast_enable_late_shipments_email: wcast_enable_late_shipments_email,
|
360 |
-
settings_data: settings_data,
|
361 |
-
};
|
362 |
-
jQuery.ajax({
|
363 |
-
url: ajaxurl,
|
364 |
-
data: ajax_data,
|
365 |
-
type: 'POST',
|
366 |
-
success: function(response) {
|
367 |
-
jQuery("#ast_settings_snackbar").addClass('show_snackbar');
|
368 |
-
jQuery("#ast_settings_snackbar").text(shipment_tracking_table_rows.i18n.data_saved);
|
369 |
-
setTimeout(function(){ jQuery("#ast_settings_snackbar").removeClass('show_snackbar'); }, 3000);
|
370 |
-
},
|
371 |
-
error: function(response) {
|
372 |
-
}
|
373 |
-
});
|
374 |
-
});
|
375 |
-
|
376 |
jQuery(document).on("click", ".status_slide", function(){
|
377 |
var id = jQuery(this).val();
|
378 |
if(jQuery(this).prop("checked") == true){
|
347 |
jQuery('.csv_error_details_ul li').remove();
|
348 |
});
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
jQuery(document).on("click", ".status_slide", function(){
|
351 |
var id = jQuery(this).val();
|
352 |
if(jQuery(this).prop("checked") == true){
|
includes/ast-pro.php
ADDED
@@ -0,0 +1,728 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @wordpress-plugin
|
4 |
+
* Plugin Name: Advanced Shipment Tracking Pro
|
5 |
+
* Plugin URI: https://www.zorem.com/shop/tracking-per-item-ast-add-on/
|
6 |
+
* Description: The complete toolset for managing and automating the post-shipping workflow.
|
7 |
+
* Version: 1.1
|
8 |
+
* Author: zorem
|
9 |
+
* Author URI: https://zorem.com
|
10 |
+
* License: GPLv3
|
11 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0
|
12 |
+
* Text Domain: ast-pro
|
13 |
+
* Domain Path: /lang/
|
14 |
+
* WC tested up to: 5.2.2
|
15 |
+
* This program is free software: you can redistribute it and/or modify
|
16 |
+
* it under the terms of the GNU General Public License as published by
|
17 |
+
* the Free Software Foundation, either version 3 of the License, or
|
18 |
+
* (at your option) any later version.
|
19 |
+
*
|
20 |
+
* This program is distributed in the hope that it will be useful,
|
21 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
* GNU General Public License for more details.
|
24 |
+
*
|
25 |
+
* You should have received a copy of the GNU General Public License
|
26 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
+
*
|
28 |
+
* @package zorem
|
29 |
+
*/
|
30 |
+
|
31 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
+
exit;
|
33 |
+
}
|
34 |
+
|
35 |
+
class ast_pro {
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Advanced Shipment Tracking Pro version.
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
public $version = '1.1';
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize the main plugin function
|
46 |
+
*/
|
47 |
+
public function __construct() {
|
48 |
+
|
49 |
+
// Add your templates to this array.
|
50 |
+
if (!defined('SHIPMENT_TRACKING_PATH')) define( 'SHIPMENT_TRACKING_PATH', $this->get_plugin_path());
|
51 |
+
|
52 |
+
$this->plugin_file = __FILE__;
|
53 |
+
// Add your templates to this array.
|
54 |
+
|
55 |
+
if ( $this->is_wc_active() ) {
|
56 |
+
|
57 |
+
$this->includes();
|
58 |
+
|
59 |
+
// Init REST API.
|
60 |
+
$this->init_rest_api();
|
61 |
+
|
62 |
+
//start adding hooks
|
63 |
+
$this->init();
|
64 |
+
|
65 |
+
$this->ast_tpi->init();
|
66 |
+
$this->ast_pro_admin->init();
|
67 |
+
|
68 |
+
//plugin admin_notice class init
|
69 |
+
$this->ast_pro_admin_notice->init();
|
70 |
+
|
71 |
+
//plugin install class init
|
72 |
+
$this->ast_pro_install->init();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Check if Paypal Tracking for WooCommerce is active
|
78 |
+
*
|
79 |
+
* @access private
|
80 |
+
* @since 1.0.0
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
private function is_ptw_active() {
|
84 |
+
|
85 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
86 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( is_plugin_active( 'paypal-tracking-for-woocommerce/paypal-tracking-for-woocommerce.php' ) ) {
|
90 |
+
$is_active = true;
|
91 |
+
} else {
|
92 |
+
$is_active = false;
|
93 |
+
}
|
94 |
+
|
95 |
+
return $is_active;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Check if WooCommerce is active
|
100 |
+
*
|
101 |
+
* @access private
|
102 |
+
* @since 1.0.0
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
private function is_wc_active() {
|
106 |
+
|
107 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
108 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
112 |
+
$is_active = true;
|
113 |
+
} else {
|
114 |
+
$is_active = false;
|
115 |
+
}
|
116 |
+
|
117 |
+
// Do the WC active check
|
118 |
+
if ( false === $is_active ) {
|
119 |
+
add_action( 'admin_notices', array( $this, 'notice_activate_wc' ) );
|
120 |
+
}
|
121 |
+
return $is_active;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Gets the absolute plugin path without a trailing slash, e.g.
|
126 |
+
* /path/to/wp-content/plugins/plugin-directory.
|
127 |
+
*
|
128 |
+
* @return string plugin path
|
129 |
+
*/
|
130 |
+
public function get_plugin_path() {
|
131 |
+
if ( isset( $this->plugin_path ) ) {
|
132 |
+
return $this->plugin_path;
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
|
136 |
+
|
137 |
+
return $this->plugin_path;
|
138 |
+
}
|
139 |
+
|
140 |
+
/*
|
141 |
+
* return plugin directory URL
|
142 |
+
*/
|
143 |
+
public function plugin_dir_url(){
|
144 |
+
return plugin_dir_url( __FILE__ );
|
145 |
+
}
|
146 |
+
|
147 |
+
/*
|
148 |
+
* return shipment provider table
|
149 |
+
*/
|
150 |
+
public function shippment_provider_table() {
|
151 |
+
global $wpdb;
|
152 |
+
|
153 |
+
$table = $wpdb->prefix . 'woo_shippment_provider';
|
154 |
+
|
155 |
+
if( is_multisite() ) {
|
156 |
+
|
157 |
+
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
158 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
159 |
+
}
|
160 |
+
|
161 |
+
if ( is_plugin_active_for_network( 'ast-pro/ast-pro.php' ) ) {
|
162 |
+
$main_blog_prefix = $wpdb->get_blog_prefix( BLOG_ID_CURRENT_SITE );
|
163 |
+
$table = $main_blog_prefix . 'woo_shippment_provider';
|
164 |
+
} else {
|
165 |
+
$table = $wpdb->prefix . 'woo_shippment_provider';
|
166 |
+
}
|
167 |
+
|
168 |
+
} else {
|
169 |
+
$table = $wpdb->prefix . 'woo_shippment_provider';
|
170 |
+
}
|
171 |
+
|
172 |
+
return $table;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Init advanced shipment tracking REST API.
|
177 |
+
*/
|
178 |
+
private function init_rest_api() {
|
179 |
+
add_action( 'rest_api_init', array( $this, 'rest_api_register_routes' ) );
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Register shipment tracking routes.
|
184 |
+
*
|
185 |
+
* @since 1.5.0
|
186 |
+
*/
|
187 |
+
public function rest_api_register_routes() {
|
188 |
+
|
189 |
+
if ( ! is_a( WC()->api, 'WC_API' ) ) {
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
|
193 |
+
if ( !class_exists( 'AST_Pro_Actions' ) ){
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
|
197 |
+
require_once $this->get_plugin_path() . '/includes/api/class-wc-ast-pro-rest-api-controller.php';
|
198 |
+
|
199 |
+
// Register route with default namespace wc/v3.
|
200 |
+
$ast_api_controller = new WC_AST_PRO_REST_API_Controller();
|
201 |
+
$ast_api_controller->register_routes();
|
202 |
+
|
203 |
+
// These are all the same code but with different namespaces for compatibility reasons.
|
204 |
+
$ast_api_controller_v1 = new WC_AST_PRO_REST_API_Controller();
|
205 |
+
$ast_api_controller_v1->set_namespace( 'wc-ast/v3' );
|
206 |
+
$ast_api_controller_v1->register_routes();
|
207 |
+
|
208 |
+
$ast_api_controller_v1 = new WC_AST_PRO_REST_API_Controller();
|
209 |
+
$ast_api_controller_v1->set_namespace( 'wc/v1' );
|
210 |
+
$ast_api_controller_v1->register_routes();
|
211 |
+
|
212 |
+
$ast_api_controller_v2 = new WC_AST_PRO_REST_API_Controller();
|
213 |
+
$ast_api_controller_v2->set_namespace( 'wc/v2' );
|
214 |
+
$ast_api_controller_v2->register_routes();
|
215 |
+
|
216 |
+
$ast_api_controller_v3 = new WC_AST_PRO_REST_API_Controller();
|
217 |
+
$ast_api_controller_v3->set_namespace( 'wc/v3' );
|
218 |
+
$ast_api_controller_v3->register_routes();
|
219 |
+
|
220 |
+
$shipment_api_controller_v3 = new WC_AST_PRO_REST_API_Controller();
|
221 |
+
$shipment_api_controller_v3->set_namespace( 'wc-shipment-tracking/v3' );
|
222 |
+
$shipment_api_controller_v3->register_routes();
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Include files
|
227 |
+
*/
|
228 |
+
public function includes(){
|
229 |
+
|
230 |
+
require_once $this->get_plugin_path() . '/includes/class-ast-pro-install.php';
|
231 |
+
$this->ast_pro_install = AST_PRO_Install::get_instance();
|
232 |
+
|
233 |
+
require_once $this->get_plugin_path() . '/includes/class-ast-pro-admin-notice.php';
|
234 |
+
$this->ast_pro_admin_notice = AST_PRO_Admin_notice::get_instance();
|
235 |
+
|
236 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-settings.php';
|
237 |
+
$this->ast_pro_settings = AST_PRO_Settings::get_instance();
|
238 |
+
|
239 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-admin.php';
|
240 |
+
$this->ast_pro_admin = AST_pro_admin::get_instance();
|
241 |
+
|
242 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-actions.php';
|
243 |
+
$this->ast_pro_actions = AST_Pro_Actions::get_instance();
|
244 |
+
|
245 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-tpi.php';
|
246 |
+
$this->ast_tpi = AST_tpi::get_instance();
|
247 |
+
|
248 |
+
$enable_shipstation_default = ( is_plugin_active( 'woocommerce-shipstation-integration/woocommerce-shipstation.php' ) ) ? 1 : 0;
|
249 |
+
$enable_shipstation = get_option( 'enable_shipstation_integration', $enable_shipstation_default );
|
250 |
+
if ( $enable_shipstation ) {
|
251 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-shipstation.php';
|
252 |
+
}
|
253 |
+
|
254 |
+
$enable_wc_shipping_default = ( is_plugin_active( 'woocommerce-services/woocommerce-services.php' ) ) ? 1 : 0;
|
255 |
+
$enable_wc_shipping = get_option( 'enable_wc_shipping_integration', $enable_wc_shipping_default );
|
256 |
+
if ( $enable_wc_shipping ) {
|
257 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-wc-services.php';
|
258 |
+
}
|
259 |
+
|
260 |
+
$enable_ups_shipping = get_option( 'enable_ups_shipping_label_pluginhive', 0 );
|
261 |
+
if ( $enable_ups_shipping ) {
|
262 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-ups-shipping-label.php';
|
263 |
+
}
|
264 |
+
|
265 |
+
$enable_quickbooks_commerce = get_option( 'enable_quickbooks_commerce_integration', 0 );
|
266 |
+
if ( $enable_quickbooks_commerce ) {
|
267 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-quickbooks-commerce.php';
|
268 |
+
}
|
269 |
+
|
270 |
+
$enable_readytoship = get_option( 'enable_readytoship_integration', 0 );
|
271 |
+
if ( $enable_readytoship ) {
|
272 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-readytoship.php';
|
273 |
+
$this->ast_pro_readytoship = AST_pro_readytoship::get_instance();
|
274 |
+
$this->ast_pro_readytoship->init();
|
275 |
+
}
|
276 |
+
|
277 |
+
$enable_royalmail = get_option( 'enable_royalmail_integration', 0 );
|
278 |
+
if ( $enable_royalmail ) {
|
279 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-royalmail.php';
|
280 |
+
}
|
281 |
+
|
282 |
+
$enable_customcat = get_option( 'enable_customcat_integration', 0 );
|
283 |
+
if ( $enable_customcat ) {
|
284 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-customcat.php';
|
285 |
+
}
|
286 |
+
|
287 |
+
$pdf_invoice_by_ewout_default = ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) ? 1 : 0;
|
288 |
+
$enable_pdf_invoice_by_ewout = get_option( 'enable_pdf_invoice_integration_ewout', $pdf_invoice_by_ewout_default );
|
289 |
+
if ( $enable_pdf_invoice_by_ewout ) {
|
290 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-pdf-invoice-by-ewout.php';
|
291 |
+
}
|
292 |
+
|
293 |
+
$pdf_invoice_by_bas_default = ( is_plugin_active( 'woocommerce-pdf-invoices/bootstrap.php' ) ) ? 1 : 0;
|
294 |
+
$enable_pdf_invoice_by_bas = get_option( 'enable_pdf_invoice_integration_bas', $pdf_invoice_by_bas_default );
|
295 |
+
if ( $enable_pdf_invoice_by_bas ) {
|
296 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-pdf-invoice-by-bas.php';
|
297 |
+
}
|
298 |
+
|
299 |
+
$ali2woo_default = ( is_plugin_active( 'ali2woo-lite/ali2woo-lite.php' ) ) ? 1 : 0;
|
300 |
+
$enable_ali2woo = get_option( 'enable_ali2woo_integration', $ali2woo_default );
|
301 |
+
if ( $enable_ali2woo ) {
|
302 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/integration/class-ast-pro-ali2woo-integration.php';
|
303 |
+
}
|
304 |
+
|
305 |
+
//license
|
306 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-license-manager.php';
|
307 |
+
$this->license = AST_Pro_License_Manager::get_instance();
|
308 |
+
|
309 |
+
//update-manager
|
310 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-ast-pro-update-manager.php';
|
311 |
+
new AST_Pro_Update_Manager (
|
312 |
+
$this->version,
|
313 |
+
'ast-pro/ast-pro.php',
|
314 |
+
$this->license->get_item_code()
|
315 |
+
);
|
316 |
+
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Display WC active notice
|
321 |
+
*
|
322 |
+
* @access public
|
323 |
+
* @since 1.0.0
|
324 |
+
*/
|
325 |
+
public function notice_activate_wc() {
|
326 |
+
?>
|
327 |
+
<div class="error">
|
328 |
+
<p><?php printf( __( 'Please install and activate %sWooCommerce%s for Advanced Shipment Tracking Pro!', 'ast-pro' ), '<a href="' . admin_url( 'plugin-install.php?tab=search&s=WooCommerce&plugin-search-input=Search+Plugins' ) . '">', '</a>' ); ?></p>
|
329 |
+
</div>
|
330 |
+
<?php
|
331 |
+
}
|
332 |
+
|
333 |
+
/*
|
334 |
+
* init when class loaded
|
335 |
+
*/
|
336 |
+
public function init(){
|
337 |
+
|
338 |
+
//text domain hooks
|
339 |
+
add_action( 'plugins_loaded', array( $this, 'ast_pro_load_textdomain'));
|
340 |
+
register_activation_hook( __FILE__, array( $this->ast_pro_install, 'ast_pro_install' ) );
|
341 |
+
|
342 |
+
//deactivate AST Addons on activate plugin
|
343 |
+
register_activation_hook( __FILE__, array( $this,'deactivate_addons_on_plugin_activation' ) );
|
344 |
+
add_action( 'admin_notices', array( $this, 'ast_pro_admin_notice' ) );
|
345 |
+
|
346 |
+
add_action( 'init', array( $this, 'update_database_check'));
|
347 |
+
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ), 100, 1 );
|
348 |
+
|
349 |
+
add_action( 'admin_footer', array( $this, 'uninstall_notice') );
|
350 |
+
add_action( 'wp_ajax_ast_pro_reassign_order_status', array( $this, 'ast_pro_reassign_order_status' ) );
|
351 |
+
|
352 |
+
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'ast_pro_plugin_action_links' ) );
|
353 |
+
}
|
354 |
+
|
355 |
+
/*** Method load Language file ***/
|
356 |
+
function ast_pro_load_textdomain() {
|
357 |
+
load_plugin_textdomain( 'ast-pro', false, dirname( plugin_basename(__FILE__) ) . '/lang' );
|
358 |
+
}
|
359 |
+
|
360 |
+
/*
|
361 |
+
* include file on plugin load
|
362 |
+
*/
|
363 |
+
public function on_plugins_loaded() {
|
364 |
+
|
365 |
+
require_once $this->get_plugin_path() . '/includes/ast-pro-email-manager.php';
|
366 |
+
|
367 |
+
require_once $this->get_plugin_path() . '/includes/tracking-info.php';
|
368 |
+
|
369 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-ast-pro-customizer.php';
|
370 |
+
|
371 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-ast-pro-completed-email-customizer.php';
|
372 |
+
|
373 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-ast-pro-tracking-info-customizer.php';
|
374 |
+
|
375 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-ast-pro-partial-shipped-email-customizer.php';
|
376 |
+
|
377 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-ast-pro-shipped-email-customizer.php';
|
378 |
+
|
379 |
+
$enable_leagace_add_tracking = get_option( "wc_ast_enable_leagace_add_tracking", 0);
|
380 |
+
if ( !$enable_leagace_add_tracking ) {
|
381 |
+
$ast = AST_Pro_Actions::get_instance();
|
382 |
+
remove_action( 'ast_add_tracking_btn', array( $ast, 'ast_add_tracking_btn' ) );
|
383 |
+
add_action( 'ast_add_tracking_btn', array( $this->ast_pro_admin, 'ast_add_tracking_btn' ) );
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
/*
|
388 |
+
* database update
|
389 |
+
*/
|
390 |
+
public function update_database_check() {
|
391 |
+
|
392 |
+
if ( is_admin() ){
|
393 |
+
|
394 |
+
if ( version_compare( get_option( 'tracking_per_item_addon_db_version' ), '1.3.2', '<' ) ) {
|
395 |
+
$license_key = get_option( 'ast_product_license_key', false );
|
396 |
+
$status = get_option( 'ast_product_license_status', false );
|
397 |
+
$instance_id = get_option( 'ast_per_product_instance_id', false );
|
398 |
+
$this->license->set_license_key( $license_key );
|
399 |
+
$this->license->set_license_status( $status );
|
400 |
+
$this->license->set_instance_id( $instance_id );
|
401 |
+
update_option( 'tracking_per_item_addon_db_version', '1.3.2' );
|
402 |
+
}
|
403 |
+
|
404 |
+
if( isset( $_GET['page'] ) && 'woocommerce-advanced-shipment-tracking' == $_GET['page'] ) {
|
405 |
+
$this->license->check_license_valid();
|
406 |
+
}
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
/*
|
411 |
+
* AST Addons deactivate on activation
|
412 |
+
*/
|
413 |
+
public function deactivate_addons_on_plugin_activation(){
|
414 |
+
|
415 |
+
//Deactivate Tracking Per Item Add-on
|
416 |
+
if ( is_plugin_active( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' ) ) {
|
417 |
+
deactivate_plugins( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' );
|
418 |
+
set_transient( 'ast_pro_tpi_deactivate', 'tpi_deactivate_notice' );
|
419 |
+
}
|
420 |
+
|
421 |
+
//Deactivate ShipStation Tracking Add-on for AST
|
422 |
+
if ( is_plugin_active( 'ast-compatibility-with-wc-shipstation/ast-compatibility-with-wc-shipstation.php' ) ) {
|
423 |
+
deactivate_plugins( 'ast-compatibility-with-wc-shipstation/ast-compatibility-with-wc-shipstation.php' );
|
424 |
+
set_transient( 'ast_pro_shipstation_deactivate', 'ast_shipstation_deactivate_notice' );
|
425 |
+
}
|
426 |
+
|
427 |
+
//Deactivate WooCommerce Shipping Tracking Add-on for AST
|
428 |
+
if ( is_plugin_active( 'ast-compatibility-with-wc-services/ast-compatibility-with-wc-services.php' ) ) {
|
429 |
+
deactivate_plugins('ast-compatibility-with-wc-services/ast-compatibility-with-wc-services.php' );
|
430 |
+
set_transient( 'ast_pro_wc_services_deactivate', 'ast_wc_services_deactivate_notice' );
|
431 |
+
}
|
432 |
+
|
433 |
+
//Deactivate ReadyToShip Tracking Add-on for AST
|
434 |
+
if ( is_plugin_active( 'ast-compatibility-with-readytoship/ast-compatibility-with-readytoship.php' ) ) {
|
435 |
+
deactivate_plugins('ast-compatibility-with-readytoship/ast-compatibility-with-readytoship.php' );
|
436 |
+
set_transient( 'ast_pro_readytoship_deactivate', 'ast_readytoship_deactivate_notice' );
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* AST Pro admin notice
|
442 |
+
*
|
443 |
+
* @since 1.0.0
|
444 |
+
*/
|
445 |
+
function ast_pro_admin_notice() {
|
446 |
+
|
447 |
+
//Display Tracking Per Item Add-on notice
|
448 |
+
if ( 'tpi_deactivate_notice' == get_transient( 'ast_pro_tpi_deactivate' ) ) {
|
449 |
+
?>
|
450 |
+
<div id="message" class="updated notice is-dismissible">
|
451 |
+
<p>We deactivated the Tracking Per Item Add-on when the AST PRO is installed, you can remove the Tracking Per Item Add-on from your store.</p>
|
452 |
+
</div>
|
453 |
+
<?php
|
454 |
+
delete_transient( 'ast_pro_tpi_deactivate' );
|
455 |
+
}
|
456 |
+
|
457 |
+
//Display ShipStation Tracking Add-on for AST notice
|
458 |
+
if ( 'ast_shipstation_deactivate_notice' == get_transient( 'ast_pro_shipstation_deactivate' ) ) {
|
459 |
+
?>
|
460 |
+
<div id="message" class="updated notice is-dismissible">
|
461 |
+
<p>We deactivated the ShipStation Tracking Add-on for AST when the AST PRO is installed, you can remove the ShipStation Tracking Add-on for AST from your store.</p>
|
462 |
+
</div>
|
463 |
+
<?php
|
464 |
+
delete_transient( 'ast_pro_shipstation_deactivate' );
|
465 |
+
}
|
466 |
+
|
467 |
+
//Display WooCommerce Shipping Tracking Add-on for AST notice
|
468 |
+
if ( 'ast_wc_services_deactivate_notice' == get_transient( 'ast_pro_wc_services_deactivate' ) ) {
|
469 |
+
?>
|
470 |
+
<div id="message" class="updated notice is-dismissible">
|
471 |
+
<p>We deactivated the WooCommerce Shipping Tracking Add-on for AST when the AST PRO is installed, you can remove the WooCommerce Shipping Tracking Add-on for AST from your store.</p>
|
472 |
+
</div>
|
473 |
+
<?php
|
474 |
+
delete_transient( 'ast_pro_wc_services_deactivate' );
|
475 |
+
}
|
476 |
+
|
477 |
+
//Display ReadyToShip Tracking Add-on for AST notice
|
478 |
+
if ( 'ast_readytoship_deactivate_notice' == get_transient( 'ast_pro_readytoship_deactivate' ) ) {
|
479 |
+
?>
|
480 |
+
<div id="message" class="updated notice is-dismissible">
|
481 |
+
<p>We deactivated the ReadyToShip Tracking Add-on for AST when the AST PRO is installed, you can remove the ReadyToShip Tracking Add-on for AST from your store.</p>
|
482 |
+
</div>
|
483 |
+
<?php
|
484 |
+
delete_transient( 'ast_pro_readytoship_deactivate' );
|
485 |
+
}
|
486 |
+
}
|
487 |
+
|
488 |
+
/*
|
489 |
+
* Plugin uninstall code
|
490 |
+
*/
|
491 |
+
public function uninstall_notice() {
|
492 |
+
$screen = get_current_screen();
|
493 |
+
|
494 |
+
if ( 'plugins.php' == $screen->parent_file ) {
|
495 |
+
wp_enqueue_style( 'ast_styles', $this->plugin_dir_url() . 'assets/css/admin.css', array(), $this->version );
|
496 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
497 |
+
wp_enqueue_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
|
498 |
+
}
|
499 |
+
|
500 |
+
$shipped_count = wc_orders_count( 'shipped' );
|
501 |
+
$delivered_count = wc_orders_count( 'delivered' );
|
502 |
+
$ps_count = wc_orders_count( 'partial-shipped' );
|
503 |
+
|
504 |
+
$order_statuses = wc_get_order_statuses();
|
505 |
+
|
506 |
+
unset( $order_statuses['wc-shipped'] );
|
507 |
+
unset( $order_statuses['wc-partial-shipped'] );
|
508 |
+
unset( $order_statuses['wc-delivered'] );
|
509 |
+
|
510 |
+
if( $shipped_count > 0 || $delivered_count > 0 || $ps_count > 0 ) {
|
511 |
+
?>
|
512 |
+
|
513 |
+
<script>
|
514 |
+
|
515 |
+
jQuery(document).on("click","[data-slug='advanced-shipment-tracking-pro'] .deactivate a",function(e){
|
516 |
+
e.preventDefault();
|
517 |
+
jQuery('.as_pro_uninstall_popup').show();
|
518 |
+
var theHREF = jQuery(this).attr("href");
|
519 |
+
jQuery(document).on("click",".ast_pro_uninstall_plugin",function(e){
|
520 |
+
jQuery("body").block({
|
521 |
+
message: null,
|
522 |
+
overlayCSS: {
|
523 |
+
background: "#fff",
|
524 |
+
opacity: .6
|
525 |
+
}
|
526 |
+
});
|
527 |
+
var form = jQuery('#ast_pro_order_reassign_form');
|
528 |
+
jQuery.ajax({
|
529 |
+
url: ajaxurl,
|
530 |
+
data: form.serialize(),
|
531 |
+
type: 'POST',
|
532 |
+
success: function(response) {
|
533 |
+
jQuery("body").unblock();
|
534 |
+
window.location.href = theHREF;
|
535 |
+
},
|
536 |
+
error: function(response) {
|
537 |
+
console.log(response);
|
538 |
+
}
|
539 |
+
});
|
540 |
+
});
|
541 |
+
});
|
542 |
+
|
543 |
+
jQuery(document).on("click",".popupclose",function(e){
|
544 |
+
jQuery('.as_pro_uninstall_popup').hide();
|
545 |
+
});
|
546 |
+
|
547 |
+
jQuery(document).on("click",".ast_pro_uninstall_close",function(e){
|
548 |
+
jQuery('.as_pro_uninstall_popup').hide();
|
549 |
+
});
|
550 |
+
|
551 |
+
jQuery(document).on("click",".popup_close_icon",function(e){
|
552 |
+
jQuery('.as_pro_uninstall_popup').hide();
|
553 |
+
});
|
554 |
+
</script>
|
555 |
+
<div id="" class="popupwrapper as_pro_uninstall_popup" style="display:none;">
|
556 |
+
<div class="popuprow">
|
557 |
+
<div class="popup_header">
|
558 |
+
<h3 class="popup_title">Advanced Shipment Tracking Pro</h3>
|
559 |
+
<span class="dashicons dashicons-no-alt popup_close_icon"></span>
|
560 |
+
</div>
|
561 |
+
<div class="popup_body">
|
562 |
+
<form method="post" id="ast_pro_order_reassign_form">
|
563 |
+
<?php
|
564 |
+
|
565 |
+
if ( $shipped_count > 0 ) {
|
566 |
+
?>
|
567 |
+
<p><?php
|
568 |
+
/* translators: %s: replace with Partially Shipped order count */
|
569 |
+
printf( esc_html__('We detected %s orders that use the Shipped order status, You can reassign these orders to a different status', 'ast-pro'), $shipped_count );
|
570 |
+
?>
|
571 |
+
</p>
|
572 |
+
|
573 |
+
<select id="reassign_shipped_order" name="reassign_shipped_order" class="reassign_select">
|
574 |
+
<option value=""><?php _e('Select', 'woocommerce'); ?></option>
|
575 |
+
<?php foreach($order_statuses as $key => $status){ ?>
|
576 |
+
<option value="<?php echo $key; ?>"><?php echo $status; ?></option>
|
577 |
+
<?php } ?>
|
578 |
+
</select>
|
579 |
+
|
580 |
+
<?php } ?>
|
581 |
+
<?php
|
582 |
+
if ( $delivered_count > 0 ) {
|
583 |
+
?>
|
584 |
+
|
585 |
+
<p><?php
|
586 |
+
/* translators: %s: replace with delivered order count */
|
587 |
+
printf( esc_html__('We detected %s orders that use the Delivered order status, You can reassign these orders to a different status', 'ast-pro'), $delivered_count );
|
588 |
+
?>
|
589 |
+
</p>
|
590 |
+
<select id="reassign_delivered_order" name="reassign_delivered_order" class="reassign_select">
|
591 |
+
<option value=""><?php _e('Select', 'woocommerce'); ?></option>
|
592 |
+
<?php foreach($order_statuses as $key => $status){ ?>
|
593 |
+
<option value="<?php echo $key; ?>"><?php echo $status; ?></option>
|
594 |
+
<?php } ?>
|
595 |
+
</select>
|
596 |
+
|
597 |
+
<?php }
|
598 |
+
|
599 |
+
if ( $ps_count > 0 ) {
|
600 |
+
?>
|
601 |
+
<p><?php
|
602 |
+
/* translators: %s: replace with Partially Shipped order count */
|
603 |
+
printf( esc_html__('We detected %s orders that use the Partially Shipped order status, You can reassign these orders to a different status', 'ast-pro'), $ps_count );
|
604 |
+
?>
|
605 |
+
</p>
|
606 |
+
|
607 |
+
<select id="reassign_ps_order" name="reassign_ps_order" class="reassign_select">
|
608 |
+
<option value=""><?php _e('Select', 'woocommerce'); ?></option>
|
609 |
+
<?php foreach($order_statuses as $key => $status){ ?>
|
610 |
+
<option value="<?php echo $key; ?>"><?php echo $status; ?></option>
|
611 |
+
<?php } ?>
|
612 |
+
</select>
|
613 |
+
|
614 |
+
<?php } ?>
|
615 |
+
<p>
|
616 |
+
<input type="hidden" name="action" value="ast_pro_reassign_order_status">
|
617 |
+
<input type="button" value="Uninstall" class="ast_pro_uninstall_plugin button-primary btn_ast2">
|
618 |
+
<input type="button" value="Close" class="ast_pro_uninstall_close button-primary btn_red">
|
619 |
+
</p>
|
620 |
+
</form>
|
621 |
+
</div>
|
622 |
+
</div>
|
623 |
+
<div class="popupclose"></div>
|
624 |
+
</div>
|
625 |
+
<?php }
|
626 |
+
}
|
627 |
+
|
628 |
+
/*
|
629 |
+
* Functon for reassign order status on plugin deactivation
|
630 |
+
*/
|
631 |
+
public function ast_pro_reassign_order_status() {
|
632 |
+
|
633 |
+
$reassign_shipped_order = isset( $_POST['reassign_shipped_order'] ) ? wc_clean( $_POST['reassign_shipped_order'] ) : '';
|
634 |
+
$reassign_delivered_order = isset( $_POST['reassign_delivered_order'] ) ? wc_clean( $_POST['reassign_delivered_order'] ) : '';
|
635 |
+
$reassign_ps_order = isset( $_POST['reassign_ps_order'] ) ? wc_clean( $_POST['reassign_ps_order'] ) : '';
|
636 |
+
|
637 |
+
if ( '' != $reassign_shipped_order ) {
|
638 |
+
|
639 |
+
$args = array(
|
640 |
+
'status' => 'shipped',
|
641 |
+
'limit' => '-1',
|
642 |
+
);
|
643 |
+
|
644 |
+
$orders = wc_get_orders( $args );
|
645 |
+
|
646 |
+
foreach ( $orders as $order ) {
|
647 |
+
$order_id = $order->get_id();
|
648 |
+
$order = new WC_Order( $order_id );
|
649 |
+
$order->update_status( $reassign_shipped_order );
|
650 |
+
}
|
651 |
+
}
|
652 |
+
|
653 |
+
if ( '' != $reassign_delivered_order ) {
|
654 |
+
|
655 |
+
$args = array(
|
656 |
+
'status' => 'delivered',
|
657 |
+
'limit' => '-1',
|
658 |
+
);
|
659 |
+
|
660 |
+
$orders = wc_get_orders( $args );
|
661 |
+
|
662 |
+
foreach ( $orders as $order ) {
|
663 |
+
$order_id = $order->get_id();
|
664 |
+
$order = new WC_Order( $order_id );
|
665 |
+
$order->update_status( $reassign_delivered_order );
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
if ( '' != $reassign_ps_order ) {
|
670 |
+
|
671 |
+
$args = array(
|
672 |
+
'status' => 'partial-shipped',
|
673 |
+
'limit' => '-1',
|
674 |
+
);
|
675 |
+
|
676 |
+
$ps_orders = wc_get_orders( $args );
|
677 |
+
|
678 |
+
foreach ( $ps_orders as $order ) {
|
679 |
+
$order_id = $order->get_id();
|
680 |
+
$order = new WC_Order( $order_id );
|
681 |
+
$order->update_status( $reassign_ps_order );
|
682 |
+
}
|
683 |
+
}
|
684 |
+
echo 1;
|
685 |
+
die();
|
686 |
+
}
|
687 |
+
|
688 |
+
/**
|
689 |
+
* Add plugin action links.
|
690 |
+
*
|
691 |
+
* Add a link to the settings page on the plugins.php page.
|
692 |
+
*
|
693 |
+
* @since 2.6.5
|
694 |
+
*
|
695 |
+
* @param array $links List of existing plugin action links.
|
696 |
+
* @return array List of modified plugin action links.
|
697 |
+
*/
|
698 |
+
public function ast_pro_plugin_action_links ( $links ) {
|
699 |
+
return array_merge( array(
|
700 |
+
'<a href="' . esc_url( admin_url( '/admin.php?page=woocommerce-advanced-shipment-tracking' ) ) . '">' . __( 'Settings' ) . '</a>'
|
701 |
+
), $links );
|
702 |
+
}
|
703 |
+
}
|
704 |
+
|
705 |
+
/**
|
706 |
+
* Returns an instance of ast_pro.
|
707 |
+
*
|
708 |
+
* @since 1.0.0
|
709 |
+
* @version 1.0.0
|
710 |
+
*
|
711 |
+
* @return ast_pro
|
712 |
+
*/
|
713 |
+
function ast_pro() {
|
714 |
+
static $instance;
|
715 |
+
|
716 |
+
if ( ! isset( $instance ) ) {
|
717 |
+
$instance = new ast_pro();
|
718 |
+
}
|
719 |
+
|
720 |
+
return $instance;
|
721 |
+
}
|
722 |
+
|
723 |
+
/**
|
724 |
+
* Register this class globally.
|
725 |
+
*
|
726 |
+
* Backward compatibility.
|
727 |
+
*/
|
728 |
+
ast_pro();
|
includes/class-wc-advanced-shipment-tracking-admin-notice.php
CHANGED
@@ -85,7 +85,7 @@ class WC_Advanced_Shipment_Tracking_Admin_notice {
|
|
85 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
86 |
<h3>Advanced Shipment Tracking Pro</h3>
|
87 |
<p>We just released the Advanced Shipment Tracking Pro! Upgrade now and enjoy a 20% off early bird discount.</p>
|
88 |
-
<p>To redeem your discount, use coupon code <strong>ASTPRO20</strong> (valid until
|
89 |
<a class="button-primary ast_notice_btn" target="blank" href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/">Upgrade to AST Pro</a>
|
90 |
<a class="button-primary ast_notice_btn" href="<?php esc_html_e( $dismissable_url ); ?>">No Thanks</a>
|
91 |
</div>
|
85 |
<a href="<?php esc_html_e( $dismissable_url ); ?>" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>
|
86 |
<h3>Advanced Shipment Tracking Pro</h3>
|
87 |
<p>We just released the Advanced Shipment Tracking Pro! Upgrade now and enjoy a 20% off early bird discount.</p>
|
88 |
+
<p>To redeem your discount, use coupon code <strong>ASTPRO20</strong> (valid until May 31st) </p>
|
89 |
<a class="button-primary ast_notice_btn" target="blank" href="https://www.zorem.com/product/woocommerce-advanced-shipment-tracking/">Upgrade to AST Pro</a>
|
90 |
<a class="button-primary ast_notice_btn" href="<?php esc_html_e( $dismissable_url ); ?>">No Thanks</a>
|
91 |
</div>
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -362,6 +362,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
362 |
require_once( 'views/admin_options_bulk_upload.php' );
|
363 |
do_action( 'ast_paypal_settings_panel' );
|
364 |
require_once( 'views/admin_options_addons.php' );
|
|
|
365 |
?>
|
366 |
</div>
|
367 |
</div>
|
@@ -378,6 +379,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
378 |
|
379 |
$ast_customizer_settings = new wcast_initialise_customizer_settings();
|
380 |
$go_pro_label = class_exists( 'ast_pro' ) ? __( 'License', 'woo-advanced-shipment-tracking' ) : __( 'Go Pro', 'woo-advanced-shipment-tracking' ) ;
|
|
|
|
|
|
|
|
|
|
|
381 |
$setting_data = array(
|
382 |
'tab2' => array(
|
383 |
'title' => __( 'Settings', 'woo-advanced-shipment-tracking' ),
|
@@ -417,6 +423,15 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
417 |
'name' => 'tabs',
|
418 |
'position' => 4,
|
419 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
'tab6' => array(
|
421 |
'title' => $go_pro_label,
|
422 |
'show' => true,
|
@@ -466,17 +481,19 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
466 |
$settings = isset( $_GET['settings'] ) ? sanitize_text_field( $_GET['settings'] ) : 'general-settings';
|
467 |
|
468 |
foreach ( (array) $arrays as $id => $array ) {
|
469 |
-
$checked = ( $tab == $array['data-tab'] || $settings == $array['data-tab'] ) ? 'checked' : '';
|
470 |
-
if(
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
|
|
|
|
480 |
}
|
481 |
}
|
482 |
|
362 |
require_once( 'views/admin_options_bulk_upload.php' );
|
363 |
do_action( 'ast_paypal_settings_panel' );
|
364 |
require_once( 'views/admin_options_addons.php' );
|
365 |
+
include 'views/admin_options_trackship_integration.php';
|
366 |
?>
|
367 |
</div>
|
368 |
</div>
|
379 |
|
380 |
$ast_customizer_settings = new wcast_initialise_customizer_settings();
|
381 |
$go_pro_label = class_exists( 'ast_pro' ) ? __( 'License', 'woo-advanced-shipment-tracking' ) : __( 'Go Pro', 'woo-advanced-shipment-tracking' ) ;
|
382 |
+
|
383 |
+
$wc_ast_api_key = get_option('wc_ast_api_key');
|
384 |
+
$ts4wc_installed = ( function_exists( 'trackship_for_woocommerce' ) ) ? true : false;
|
385 |
+
$trackship_display = ( !$wc_ast_api_key && !$ts4wc_installed ) ? true : false ;
|
386 |
+
|
387 |
$setting_data = array(
|
388 |
'tab2' => array(
|
389 |
'title' => __( 'Settings', 'woo-advanced-shipment-tracking' ),
|
423 |
'name' => 'tabs',
|
424 |
'position' => 4,
|
425 |
),
|
426 |
+
'trackship' => array(
|
427 |
+
'title' => 'TrackShip',
|
428 |
+
'show' => $trackship_display,
|
429 |
+
'class' => 'tab_label',
|
430 |
+
'data-tab' => 'trackship',
|
431 |
+
'data-label' => 'TrackShip',
|
432 |
+
'name' => 'tabs',
|
433 |
+
'position' => 4,
|
434 |
+
),
|
435 |
'tab6' => array(
|
436 |
'title' => $go_pro_label,
|
437 |
'show' => true,
|
481 |
$settings = isset( $_GET['settings'] ) ? sanitize_text_field( $_GET['settings'] ) : 'general-settings';
|
482 |
|
483 |
foreach ( (array) $arrays as $id => $array ) {
|
484 |
+
$checked = ( $tab == $array['data-tab'] || $settings == $array['data-tab'] ) ? 'checked' : '';
|
485 |
+
if( $array['show'] ) {
|
486 |
+
if( isset( $array['type'] ) && 'link' == $array['type'] ) {
|
487 |
+
?>
|
488 |
+
<a class="menu_trackship_link" href="<?php esc_html_e( esc_url( $array['link'] ) ); ?>"><?php esc_html_e( $array['title'] ); ?></a>
|
489 |
+
<?php
|
490 |
+
} else {
|
491 |
+
?>
|
492 |
+
<input class="<?php esc_html_e( $tab_class ); ?>" id="<?php esc_html_e( $id ); ?>" name="<?php esc_html_e( $array['name'] ); ?>" type="radio" data-tab="<?php esc_html_e( $array['data-tab'] ); ?>" data-label="<?php esc_html_e( $array['data-label'] ); ?>" <?php esc_html_e( $checked ); ?>/>
|
493 |
+
<label class="<?php esc_html_e( $array['class'] ); ?>" for="<?php esc_html_e( $id ); ?>"><?php esc_html_e( $array['title'] ); ?></label>
|
494 |
+
<?php
|
495 |
+
}
|
496 |
+
}
|
497 |
}
|
498 |
}
|
499 |
|
includes/class-wc-advanced-shipment-tracking-trackship.php
CHANGED
@@ -60,12 +60,13 @@ class WC_Advanced_Shipment_Tracking_Trackship {
|
|
60 |
*/
|
61 |
public function init() {
|
62 |
|
63 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'trackship_styles' ), 4 );
|
64 |
-
add_action('admin_menu', array( $this, 'register_woocommerce_trackship_menu' ), 99 );
|
65 |
|
66 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
67 |
if ( $wc_ast_api_key ) {
|
68 |
|
|
|
|
|
69 |
add_action( 'admin_notices', array( $this, 'notice_install_ts4wc' ) );
|
70 |
add_action( 'admin_init', array( $this, 'ts4wc_integration_notice_ignore' ) );
|
71 |
|
60 |
*/
|
61 |
public function init() {
|
62 |
|
63 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'trackship_styles' ), 4 );
|
|
|
64 |
|
65 |
$wc_ast_api_key = get_option( 'wc_ast_api_key' );
|
66 |
if ( $wc_ast_api_key ) {
|
67 |
|
68 |
+
add_action('admin_menu', array( $this, 'register_woocommerce_trackship_menu' ), 99 );
|
69 |
+
|
70 |
add_action( 'admin_notices', array( $this, 'notice_install_ts4wc' ) );
|
71 |
add_action( 'admin_init', array( $this, 'ts4wc_integration_notice_ignore' ) );
|
72 |
|
includes/views/admin_options_trackship_integration.php
CHANGED
@@ -4,27 +4,31 @@
|
|
4 |
*/
|
5 |
wp_enqueue_script( 'trackship_script' );
|
6 |
?>
|
7 |
-
<
|
8 |
-
<div class="">
|
9 |
-
<div class="
|
10 |
-
<
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
</div>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
<div id="" class="popupwrapper ts_video_popup" style="display:none;">
|
24 |
-
<div class="popuprow">
|
25 |
-
<div class="videoWrapper">
|
26 |
-
<iframe id="ts_video" src="https://www.youtube.com/embed/PhnqDorKN_c" frameborder="0" allowfullscreen></iframe>
|
27 |
</div>
|
28 |
</div>
|
29 |
-
|
30 |
-
</div>
|
4 |
*/
|
5 |
wp_enqueue_script( 'trackship_script' );
|
6 |
?>
|
7 |
+
<section id="trackship_landing" class="tab_section">
|
8 |
+
<div class="tab_inner_container" style="width: 100%;">
|
9 |
+
<div class="section-content trackship_section">
|
10 |
+
<div class="">
|
11 |
+
<div class="ts_col_inner">
|
12 |
+
<h1 class="ts_landing_header">Your Post-Shipping & Delivery Autopilot</h1>
|
13 |
+
<p class="ts_landing_description">Trackship is a Multi-Carrier Shipment Tracking API that seamlessly integrates into your WooCommerce store and auto-tracks your shipments, automates your orders workflow, reduces the time spent on customer service and lets you provide a superior post-purchase experience to your customers.</p>
|
14 |
+
<h3>Start for Free. 50 Free trackers for new accounts!</h3>
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
<a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&s=TrackShip+For+WooCommerce&plugin-search-input=Search+Plugins' ) ); ?>" target="_blank" class="button-primary btn_green2 btn_large"><span><?php _e('Install TrackShip for WooCommerce', 'woo-advanced-shipment-tracking'); ?></span><span class="dashicons dashicons-arrow-right-alt2"></span></a>
|
18 |
+
<div class="">
|
19 |
+
<div class="ts_col_inner ts_landing_banner">
|
20 |
+
<img src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/images/ts-header-banner.png">
|
21 |
+
<span class="dashicons dashicons-video-alt3 open_ts_video"></span>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
</div>
|
25 |
+
<div id="" class="popupwrapper ts_video_popup" style="display:none;">
|
26 |
+
<div class="popuprow">
|
27 |
+
<div class="videoWrapper">
|
28 |
+
<iframe id="ts_video" src="https://www.youtube.com/embed/PhnqDorKN_c" frameborder="0" allowfullscreen></iframe>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div class="popupclose"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
</div>
|
33 |
</div>
|
34 |
+
</section>
|
|
readme.txt
CHANGED
@@ -135,6 +135,9 @@ Yes, if you use external shipping services that work with the WooCommerce REST A
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
138 |
= 3.2.4 =
|
139 |
* Dev - Tested with WordPress 5.7.2 and WooCommerce 5.3
|
140 |
* Dev - Added admin notice for the TrackShip For WooCommerce plugin
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 3.2.4.1 =
|
139 |
+
* Enhancement - Added TrackShip menu inside Shipment Tracking if TrackShip not connected
|
140 |
+
|
141 |
= 3.2.4 =
|
142 |
* Dev - Tested with WordPress 5.7.2 and WooCommerce 5.3
|
143 |
* Dev - Added admin notice for the TrackShip For WooCommerce plugin
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
-
* Version: 3.2.4
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
@@ -20,7 +20,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
public $version = '3.2.4';
|
24 |
|
25 |
/**
|
26 |
* Initialize the main plugin function
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
+
* Version: 3.2.4.1
|
8 |
* Author: zorem
|
9 |
* Author URI: https://www.zorem.com
|
10 |
* License: GPL-2.0+
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
public $version = '3.2.4.1';
|
24 |
|
25 |
/**
|
26 |
* Initialize the main plugin function
|