Version Description
- Fixed warnings in tracking page
- Fixed error from customizer if WooCommerce uninstalled
- Fixed date format issue in Bulk Upload
- Addes Sync Providers List functionality for all users
- Added Hermes World Shipping provider
- Added option for "mark as shipped" will be selected by default when adding tracking info to orders
- Added Shipment Status filter in order list panel
- Updated Delivered orderemail customizer layout and Google analytics tracking
- Updated tracking page design
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.8 to 2.4
- assets/css/admin.css +23 -0
- assets/css/icons/invalid-user-key-v4.png +0 -0
- assets/js/customizer-scripts.js +11 -0
- assets/shipment-provider-img/gls-italy.png +0 -0
- assets/shipment-provider-img/{hermes.png → hermes-germany.png} +0 -0
- assets/shipment-provider-img/hermes-world.png +0 -0
- includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php +10 -1
- includes/class-wc-advanced-shipment-tracking-admin.php +147 -64
- includes/class-wc-advanced-shipment-tracking-api-call.php +1 -1
- includes/class-wc-advanced-shipment-tracking-front.php +11 -7
- includes/class-wc-advanced-shipment-tracking-install.php +129 -5
- includes/class-wc-advanced-shipment-tracking.php +19 -6
- includes/customizer/class-wc-availableforpickup-email-customizer.php +1 -1
- includes/customizer/class-wc-email-customizer.php +48 -28
- includes/emails/class-shipment-delivered-email.php +2 -1
- includes/views/admin_options_bulk_upload.php +1 -1
- includes/views/admin_options_settings (Eran Shor's conflicted copy 2019-08-07).php +0 -34
- includes/views/admin_options_shipping_provider.php +2 -4
- readme.txt +34 -7
- woocommerce-advanced-shipment-tracking.php +7 -7
assets/css/admin.css
CHANGED
@@ -303,6 +303,11 @@ input.tab_input_1:checked + label{
|
|
303 |
.ast_admin_content .form-table th.titledesc {
|
304 |
width: 50%;
|
305 |
}
|
|
|
|
|
|
|
|
|
|
|
306 |
.woocommerce.zorem_admin_layout table.form-table th.th_80 {
|
307 |
width: 80%;
|
308 |
}
|
@@ -762,6 +767,15 @@ span.email_status_span i.enable {
|
|
762 |
margin-top: 4px;
|
763 |
display: inline-block;
|
764 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
.wcast-shipment-status-icon .icon-delivered:before{
|
766 |
content: ' ';
|
767 |
background-image: url(icons/delivered-v4.png);
|
@@ -924,6 +938,15 @@ span.email_status_span i.enable {
|
|
924 |
display: inline-block;
|
925 |
vertical-align: middle;
|
926 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
927 |
|
928 |
.wcast-shipment-status-icon i {
|
929 |
font-size: 25px;
|
303 |
.ast_admin_content .form-table th.titledesc {
|
304 |
width: 50%;
|
305 |
}
|
306 |
+
.woocommerce .ast_admin_content table.form-table th label .woocommerce-help-tip{
|
307 |
+
margin: -4px 0 0 5px;
|
308 |
+
position: relative;
|
309 |
+
font-size: 21px;
|
310 |
+
}
|
311 |
.woocommerce.zorem_admin_layout table.form-table th.th_80 {
|
312 |
width: 80%;
|
313 |
}
|
767 |
margin-top: 4px;
|
768 |
display: inline-block;
|
769 |
}
|
770 |
+
.wcast-shipment-status-icon .icon-invalid_user_key:before{
|
771 |
+
content: ' ';
|
772 |
+
background-image: url(icons/invalid-user-key-v4.png);
|
773 |
+
width: 20px;
|
774 |
+
height: 20px;
|
775 |
+
background-size: cover;
|
776 |
+
display: inline-block;
|
777 |
+
vertical-align: middle;
|
778 |
+
}
|
779 |
.wcast-shipment-status-icon .icon-delivered:before{
|
780 |
content: ' ';
|
781 |
background-image: url(icons/delivered-v4.png);
|
938 |
display: inline-block;
|
939 |
vertical-align: middle;
|
940 |
}
|
941 |
+
.ast-shipment-status .icon-invalid_user_key:before{
|
942 |
+
content: ' ';
|
943 |
+
background-image: url(icons/invalid-user-key-v4.png);
|
944 |
+
width: 20px;
|
945 |
+
height: 20px;
|
946 |
+
background-size: cover;
|
947 |
+
display: inline-block;
|
948 |
+
vertical-align: middle;
|
949 |
+
}
|
950 |
|
951 |
.wcast-shipment-status-icon i {
|
952 |
font-size: 25px;
|
assets/css/icons/invalid-user-key-v4.png
ADDED
Binary file
|
assets/js/customizer-scripts.js
CHANGED
@@ -18,6 +18,10 @@ jQuery(document).ready(function() {
|
|
18 |
if(jQuery("#_customize-input-show_track_label").prop("checked") != true){
|
19 |
jQuery('#customize-control-track_header_text').hide();
|
20 |
}
|
|
|
|
|
|
|
|
|
21 |
|
22 |
});
|
23 |
jQuery(document).on("change", "#_customize-input-show_track_label", function(){
|
@@ -26,6 +30,13 @@ jQuery(document).on("change", "#_customize-input-show_track_label", function(){
|
|
26 |
} else{
|
27 |
jQuery('#customize-control-track_header_text').hide();
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
});
|
30 |
jQuery(document).on("change", "#customize-control-woocommerce_customer_delivered_order_settings-enabled input", function(){
|
31 |
if(jQuery(this).prop("checked") == true){
|
18 |
if(jQuery("#_customize-input-show_track_label").prop("checked") != true){
|
19 |
jQuery('#customize-control-track_header_text').hide();
|
20 |
}
|
21 |
+
|
22 |
+
if(jQuery("#_customize-input-wcast_enable_delivered_ga_tracking").prop("checked") != true){
|
23 |
+
jQuery('#customize-control-wcast_delivered_analytics_link').hide();
|
24 |
+
}
|
25 |
|
26 |
});
|
27 |
jQuery(document).on("change", "#_customize-input-show_track_label", function(){
|
30 |
} else{
|
31 |
jQuery('#customize-control-track_header_text').hide();
|
32 |
}
|
33 |
+
});
|
34 |
+
jQuery(document).on("change", "#_customize-input-wcast_enable_delivered_ga_tracking", function(){
|
35 |
+
if(jQuery(this).prop("checked") == true){
|
36 |
+
jQuery('#customize-control-wcast_delivered_analytics_link').show();
|
37 |
+
} else{
|
38 |
+
jQuery('#customize-control-wcast_delivered_analytics_link').hide();
|
39 |
+
}
|
40 |
});
|
41 |
jQuery(document).on("change", "#customize-control-woocommerce_customer_delivered_order_settings-enabled input", function(){
|
42 |
if(jQuery(this).prop("checked") == true){
|
assets/shipment-provider-img/gls-italy.png
ADDED
Binary file
|
assets/shipment-provider-img/{hermes.png → hermes-germany.png}
RENAMED
File without changes
|
assets/shipment-provider-img/hermes-world.png
ADDED
Binary file
|
includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php
CHANGED
@@ -122,7 +122,7 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
|
|
122 |
) );
|
123 |
|
124 |
//check_wcast_installed
|
125 |
-
register_rest_route( $this->namespace, '/check_wcast_installed', array(
|
126 |
array(
|
127 |
'methods' => 'POST',
|
128 |
'callback' => array( $this, 'check_wcast_installed' ),
|
@@ -136,6 +136,15 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
|
|
136 |
* check_wcast_installed
|
137 |
*/
|
138 |
public function check_wcast_installed( $request ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
$data = array(
|
140 |
'status' => 'installed'
|
141 |
);
|
122 |
) );
|
123 |
|
124 |
//check_wcast_installed
|
125 |
+
register_rest_route( $this->namespace, '/check_wcast_installed', array(
|
126 |
array(
|
127 |
'methods' => 'POST',
|
128 |
'callback' => array( $this, 'check_wcast_installed' ),
|
136 |
* check_wcast_installed
|
137 |
*/
|
138 |
public function check_wcast_installed( $request ){
|
139 |
+
$wc_ast_api_key = get_option('wc_ast_api_key');
|
140 |
+
$wc_ast_api_enabled = get_option('wc_ast_api_enabled');
|
141 |
+
if(empty($wc_ast_api_key)){
|
142 |
+
update_option('wc_ast_api_key',$request['user_key']);
|
143 |
+
}
|
144 |
+
if($wc_ast_api_enabled == ''){
|
145 |
+
update_option('wc_ast_api_enabled',1);
|
146 |
+
}
|
147 |
+
|
148 |
$data = array(
|
149 |
'status' => 'installed'
|
150 |
);
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -113,6 +113,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
113 |
// add 'get_shipment_status' order meta box order action
|
114 |
add_action( 'woocommerce_order_actions', array( $this, 'add_order_meta_box_get_shipment_status_actions' ) );
|
115 |
add_action( 'woocommerce_order_action_get_shipment_status_edit_order', array( $this, 'process_order_meta_box_actions_get_shipment_status' ) );
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
// trigger when order status changed to shipped or completed
|
@@ -135,12 +139,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
135 |
add_filter("trackship_status_filter", array($this, "trackship_status_filter_func"), 10 , 1);
|
136 |
|
137 |
// filter for shipment status icon
|
138 |
-
add_filter("trackship_status_icon_filter", array($this, "trackship_status_icon_filter_func"), 10 , 2);
|
139 |
-
|
140 |
-
//added wrong tracking filter
|
141 |
-
add_filter( 'views_edit-shop_order', array( $this, 'filter_views_edit_shop_order'), 10, 1 );
|
142 |
-
//change query for invalid tracking
|
143 |
-
add_filter( 'parse_query', array( $this, 'zorem_woocommerce_admin_order_filter_query') );
|
144 |
|
145 |
add_action( 'wcast_retry_trackship_apicall', array( $this, 'wcast_retry_trackship_apicall_func' ) );
|
146 |
|
@@ -168,7 +167,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
168 |
|
169 |
add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
|
170 |
|
171 |
-
add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun') );
|
172 |
}
|
173 |
|
174 |
/*
|
@@ -569,10 +568,12 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
569 |
$has_est_delivery = false;
|
570 |
$status = $shipment_status[$key]['status'];
|
571 |
$status_date = $shipment_status[$key]['status_date'];
|
572 |
-
$
|
|
|
|
|
573 |
if( $status != 'delivered' && $status != 'return_to_sender' && !empty($est_delivery_date) ){
|
574 |
$has_est_delivery = true;
|
575 |
-
}
|
576 |
?>
|
577 |
<li id="tracking-item-<?php echo $tracking_item['tracking_id'];?>" class="tracking-item-<?php echo $tracking_item['tracking_id'];?>">
|
578 |
<div class="wcast-shipment-status-icon">
|
@@ -715,7 +716,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
715 |
|
716 |
}
|
717 |
}
|
718 |
-
wp_enqueue_script( 'shipment_tracking_table_rows' );
|
719 |
?>
|
720 |
<h1 class="plugin-title"><?php _e('Advanced Shipment Tracking', 'woo-advanced-shipment-tracking'); ?></h1>
|
721 |
<div class="wrap woocommerce zorem_admin_layout">
|
@@ -799,6 +800,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
799 |
?>
|
800 |
<span class="mdl-list__item-secondary-action">
|
801 |
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="<?php echo $id?>">
|
|
|
802 |
<input type="checkbox" id="<?php echo $id?>" name="<?php echo $id?>" class="mdl-switch__input" <?php echo $checked ?> value="1"/>
|
803 |
</label>
|
804 |
</span>
|
@@ -1061,6 +1063,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1061 |
'show' => true,
|
1062 |
'class' => '',
|
1063 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1064 |
'wc_ast_unclude_tracking_info' => array(
|
1065 |
'type' => 'multiple_checkbox',
|
1066 |
'title' => __( 'On which customer order status email to include tracking info?', 'woo-advanced-shipment-tracking' ),'options' => array(
|
@@ -1277,7 +1286,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1277 |
$date_shipped = date("d-m-Y");
|
1278 |
}
|
1279 |
$replace_tracking_info = $_POST['replace_tracking_info'];
|
1280 |
-
|
1281 |
global $wpdb;
|
1282 |
$woo_shippment_table_name = $this->table;
|
1283 |
$shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
|
@@ -1304,7 +1313,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1304 |
if ( count( $tracking_items ) > 0 ) {
|
1305 |
foreach ( $tracking_items as $key => $item ) {
|
1306 |
$tracking_number = $item['tracking_number'];
|
1307 |
-
|
1308 |
if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
|
1309 |
|
1310 |
} else{
|
@@ -1459,6 +1468,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1459 |
case "carrier_unsupported":
|
1460 |
$status = __( 'Carrier unsupported', 'woo-advanced-shipment-tracking' );
|
1461 |
break;
|
|
|
|
|
|
|
|
|
1462 |
}
|
1463 |
return $status;
|
1464 |
}
|
@@ -1498,55 +1511,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1498 |
case "INVALID_TRACKING_NUM":
|
1499 |
$html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
|
1500 |
break;
|
|
|
|
|
|
|
1501 |
default:
|
1502 |
$html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
|
1503 |
break;
|
1504 |
|
1505 |
}
|
1506 |
return $html;
|
1507 |
-
}
|
1508 |
-
|
1509 |
-
/*
|
1510 |
-
* added wrong tracking filter
|
1511 |
-
*/
|
1512 |
-
function filter_views_edit_shop_order( $array ) {
|
1513 |
-
global $wpdb;
|
1514 |
-
$sql = "SELECT count(DISTINCT pm.post_id)
|
1515 |
-
FROM $wpdb->postmeta pm
|
1516 |
-
JOIN $wpdb->posts p ON (p.ID = pm.post_id)
|
1517 |
-
WHERE pm.meta_key = 'shipment_status' AND pm.meta_value like '%INVALID_TRACKING_NUM%' AND p.post_type = 'shop_order' ";
|
1518 |
-
$count = $wpdb->get_var($sql);
|
1519 |
-
|
1520 |
-
$query = array(
|
1521 |
-
'post_type' => 'shop_order',
|
1522 |
-
);
|
1523 |
-
$result = new WP_Query($query);
|
1524 |
-
|
1525 |
-
|
1526 |
-
$class = ( isset( $_REQUEST['wrong_tracking'] ) && $_REQUEST['wrong_tracking'] == 'yes' ) ? 'current' : '';
|
1527 |
-
$url = "edit.php?post_type=shop_order";
|
1528 |
-
$query_string = add_query_arg( 'wrong_tracking', urlencode('yes'), $url );
|
1529 |
-
$array['wrong_tracking'] = '<a href="' . $query_string . '" class="' . $class . '">' . __('Wrong Tracking ('.$count.')', 'wpla') . '</a>';
|
1530 |
-
return $array;
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
/*
|
1534 |
-
* change query for invalid tracking nunmber
|
1535 |
-
*/
|
1536 |
-
function zorem_woocommerce_admin_order_filter_query( $query ) {
|
1537 |
-
global $typenow, $wp_query, $wpdb;
|
1538 |
-
|
1539 |
-
if ( $typenow == 'shop_order' ) {
|
1540 |
-
|
1541 |
-
if ( ! empty( $_GET['wrong_tracking'] ) ) {
|
1542 |
-
|
1543 |
-
$query->set('meta_key', 'shipment_status');
|
1544 |
-
$query->set('meta_value', 'INVALID_TRACKING_NUM' );
|
1545 |
-
$query->set('meta_compare', 'LIKE' );
|
1546 |
-
|
1547 |
-
}
|
1548 |
-
}
|
1549 |
-
}
|
1550 |
|
1551 |
/*
|
1552 |
* retry trackship api call
|
@@ -1898,15 +1872,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1898 |
}
|
1899 |
|
1900 |
public function sync_providers_fun(){
|
1901 |
-
global $wpdb;
|
1902 |
-
|
1903 |
-
$url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
|
1904 |
-
$
|
1905 |
-
'body' => array(
|
1906 |
-
'user_key' => $wc_ast_api_key
|
1907 |
-
),
|
1908 |
-
);
|
1909 |
-
$resp = wp_remote_get( $url, $arg );
|
1910 |
$providers = json_decode($resp['body'],true);
|
1911 |
|
1912 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
|
@@ -2050,4 +2019,118 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2050 |
<a class="view_synch_details" id="view_deleted_details" href="javaScript:void(0);" style="display: block;"><?php _e( 'view details', 'woo-advanced-shipment-tracking'); ?></a>
|
2051 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php _e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
2052 |
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2053 |
}
|
113 |
// add 'get_shipment_status' order meta box order action
|
114 |
add_action( 'woocommerce_order_actions', array( $this, 'add_order_meta_box_get_shipment_status_actions' ) );
|
115 |
add_action( 'woocommerce_order_action_get_shipment_status_edit_order', array( $this, 'process_order_meta_box_actions_get_shipment_status' ) );
|
116 |
+
|
117 |
+
// add bulk order filter for exported / non-exported orders
|
118 |
+
add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
|
119 |
+
add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
|
120 |
}
|
121 |
|
122 |
// trigger when order status changed to shipped or completed
|
139 |
add_filter("trackship_status_filter", array($this, "trackship_status_filter_func"), 10 , 1);
|
140 |
|
141 |
// filter for shipment status icon
|
142 |
+
add_filter("trackship_status_icon_filter", array($this, "trackship_status_icon_filter_func"), 10 , 2);
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
add_action( 'wcast_retry_trackship_apicall', array( $this, 'wcast_retry_trackship_apicall_func' ) );
|
145 |
|
167 |
|
168 |
add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
|
169 |
|
170 |
+
add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun') );
|
171 |
}
|
172 |
|
173 |
/*
|
568 |
$has_est_delivery = false;
|
569 |
$status = $shipment_status[$key]['status'];
|
570 |
$status_date = $shipment_status[$key]['status_date'];
|
571 |
+
if(isset($shipment_status[$key]['est_delivery_date'])){
|
572 |
+
$est_delivery_date = $shipment_status[$key]['est_delivery_date'];
|
573 |
+
}
|
574 |
if( $status != 'delivered' && $status != 'return_to_sender' && !empty($est_delivery_date) ){
|
575 |
$has_est_delivery = true;
|
576 |
+
}
|
577 |
?>
|
578 |
<li id="tracking-item-<?php echo $tracking_item['tracking_id'];?>" class="tracking-item-<?php echo $tracking_item['tracking_id'];?>">
|
579 |
<div class="wcast-shipment-status-icon">
|
716 |
|
717 |
}
|
718 |
}
|
719 |
+
wp_enqueue_script( 'shipment_tracking_table_rows' );
|
720 |
?>
|
721 |
<h1 class="plugin-title"><?php _e('Advanced Shipment Tracking', 'woo-advanced-shipment-tracking'); ?></h1>
|
722 |
<div class="wrap woocommerce zorem_admin_layout">
|
800 |
?>
|
801 |
<span class="mdl-list__item-secondary-action">
|
802 |
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="<?php echo $id?>">
|
803 |
+
<input type="hidden" name="<?php echo $id?>" value="0"/>
|
804 |
<input type="checkbox" id="<?php echo $id?>" name="<?php echo $id?>" class="mdl-switch__input" <?php echo $checked ?> value="1"/>
|
805 |
</label>
|
806 |
</span>
|
1063 |
'show' => true,
|
1064 |
'class' => '',
|
1065 |
),
|
1066 |
+
'wc_ast_default_mark_shipped' => array(
|
1067 |
+
'type' => 'checkbox',
|
1068 |
+
'title' => __( 'Default "mark as shipped" checkbox state', 'woo-advanced-shipment-tracking' ),
|
1069 |
+
'tooltip' => __( "This means that the 'mark as shipped' will be selected by default when adding tracking info to orders.", 'woo-advanced-shipment-tracking' ),
|
1070 |
+
'show' => true,
|
1071 |
+
'class' => '',
|
1072 |
+
),
|
1073 |
'wc_ast_unclude_tracking_info' => array(
|
1074 |
'type' => 'multiple_checkbox',
|
1075 |
'title' => __( 'On which customer order status email to include tracking info?', 'woo-advanced-shipment-tracking' ),'options' => array(
|
1286 |
$date_shipped = date("d-m-Y");
|
1287 |
}
|
1288 |
$replace_tracking_info = $_POST['replace_tracking_info'];
|
1289 |
+
|
1290 |
global $wpdb;
|
1291 |
$woo_shippment_table_name = $this->table;
|
1292 |
$shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
|
1313 |
if ( count( $tracking_items ) > 0 ) {
|
1314 |
foreach ( $tracking_items as $key => $item ) {
|
1315 |
$tracking_number = $item['tracking_number'];
|
1316 |
+
//echo '<pre>';print_r($tracking_number);echo '</pre>';exit;
|
1317 |
if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
|
1318 |
|
1319 |
} else{
|
1468 |
case "carrier_unsupported":
|
1469 |
$status = __( 'Carrier unsupported', 'woo-advanced-shipment-tracking' );
|
1470 |
break;
|
1471 |
+
case "invalid_user_key":
|
1472 |
+
$status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
|
1473 |
+
break;
|
1474 |
+
|
1475 |
}
|
1476 |
return $status;
|
1477 |
}
|
1511 |
case "INVALID_TRACKING_NUM":
|
1512 |
$html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
|
1513 |
break;
|
1514 |
+
case "invalid_user_key":
|
1515 |
+
$html = '<span class="icon-'.$status.'">';
|
1516 |
+
break;
|
1517 |
default:
|
1518 |
$html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
|
1519 |
break;
|
1520 |
|
1521 |
}
|
1522 |
return $html;
|
1523 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1524 |
|
1525 |
/*
|
1526 |
* retry trackship api call
|
1872 |
}
|
1873 |
|
1874 |
public function sync_providers_fun(){
|
1875 |
+
global $wpdb;
|
1876 |
+
|
1877 |
+
$url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
|
1878 |
+
$resp = wp_remote_get( $url );
|
|
|
|
|
|
|
|
|
|
|
1879 |
$providers = json_decode($resp['body'],true);
|
1880 |
|
1881 |
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
|
2019 |
<a class="view_synch_details" id="view_deleted_details" href="javaScript:void(0);" style="display: block;"><?php _e( 'view details', 'woo-advanced-shipment-tracking'); ?></a>
|
2020 |
<a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php _e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
|
2021 |
<?php }
|
2022 |
+
/**
|
2023 |
+
* Add bulk filter for Shipment status in orders list
|
2024 |
+
*
|
2025 |
+
* @since 2.4
|
2026 |
+
*/
|
2027 |
+
public function filter_orders_by_shipment_status(){
|
2028 |
+
global $typenow;
|
2029 |
+
|
2030 |
+
if ( 'shop_order' === $typenow ) {
|
2031 |
+
|
2032 |
+
$count = $this->get_order_count();
|
2033 |
+
|
2034 |
+
$terms = array(
|
2035 |
+
'unknown' => (object) array( 'count' => $count['unknown'], 'term' => __( 'Unknown', 'woo-advanced-shipment-tracking' ) ),
|
2036 |
+
'pre_transit' => (object) array( 'count' => $count['pre_transit'],'term' => __( 'Pre Transit', 'woo-advanced-shipment-tracking' ) ),
|
2037 |
+
'in_transit' => (object) array( 'count' => $count['in_transit'],'term' => __( 'In Transit', 'woo-advanced-shipment-tracking' ) ),
|
2038 |
+
'available_for_pickup' => (object) array( 'count' => $count['available_for_pickup'],'term' => __( 'Available for Pickup', 'woo-advanced-shipment-tracking' ) ),
|
2039 |
+
'out_for_delivery' => (object) array( 'count' => $count['out_for_delivery'],'term' => __( 'Out for Delivery', 'woo-advanced-shipment-tracking' ) ),
|
2040 |
+
'delivered' => (object) array( 'count' => $count['delivered'],'term' => __( 'Delivered', 'woo-advanced-shipment-tracking' ) ),
|
2041 |
+
'failed_attempt' => (object) array( 'count' => $count['failed_attempt'],'term' => __( 'Failed Attempt', 'woo-advanced-shipment-tracking' ) ),
|
2042 |
+
'cancelled' => (object) array( 'count' => $count['cancelled'],'term' => __( 'Cancelled', 'woo-advanced-shipment-tracking' ) ),
|
2043 |
+
'carrier_unsupported' => (object) array( 'count' => $count['carrier_unsupported'],'term' => __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' ) ),
|
2044 |
+
'return_to_sender' => (object) array( 'count' => $count['return_to_sender'],'term' => __( 'Return To Sender', 'woo-advanced-shipment-tracking' ) ),
|
2045 |
+
'INVALID_TRACKING_NUM' => (object) array( 'count' => $count['invalid_tracking_number'],'term' => __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' ) ),
|
2046 |
+
);
|
2047 |
+
|
2048 |
+
?>
|
2049 |
+
<select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
|
2050 |
+
<option value=""><?php _e( 'Filter by shipment status', 'woo-advanced-shipment-tracking' ); ?></option>
|
2051 |
+
<?php foreach ( $terms as $value => $term ) : ?>
|
2052 |
+
<option value="<?php echo esc_attr( $value ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipment_status'] ) ? selected( $value, $_GET['_shop_order_shipment_status'], false ) : '' ); ?>>
|
2053 |
+
<?php printf( '%1$s (%2$s)', esc_html( $term->term ), esc_html( $term->count ) ); ?>
|
2054 |
+
</option>
|
2055 |
+
<?php endforeach; ?>
|
2056 |
+
</select>
|
2057 |
+
<?php
|
2058 |
+
}
|
2059 |
+
}
|
2060 |
+
|
2061 |
+
/**
|
2062 |
+
* Get the order count for orders by shipment status
|
2063 |
+
* @since 2.4
|
2064 |
+
*/
|
2065 |
+
private function get_order_count() {
|
2066 |
+
|
2067 |
+
$query_args = array(
|
2068 |
+
'fields' => 'ids',
|
2069 |
+
'post_type' => 'shop_order',
|
2070 |
+
'post_status' => isset( $_GET['post_status'] ) ? $_GET['post_status'] : 'any',
|
2071 |
+
'meta_query' => array(
|
2072 |
+
array(
|
2073 |
+
'key' => 'shipment_status',
|
2074 |
+
'value' => '',
|
2075 |
+
'compare' => 'LIKE',
|
2076 |
+
)
|
2077 |
+
),
|
2078 |
+
'nopaging' => true,
|
2079 |
+
);
|
2080 |
+
|
2081 |
+
$order_query = new WP_Query( $query_args );
|
2082 |
+
|
2083 |
+
$query_args['meta_query'][0]['value'] = 'delivered';
|
2084 |
+
$delivered_query = new WP_Query( $query_args );
|
2085 |
+
|
2086 |
+
$query_args['meta_query'][0]['value'] = 'unknown';
|
2087 |
+
$unknown_query = new WP_Query( $query_args );
|
2088 |
+
|
2089 |
+
$query_args['meta_query'][0]['value'] = 'pre_transit';
|
2090 |
+
$pre_transit_query = new WP_Query( $query_args );
|
2091 |
+
|
2092 |
+
$query_args['meta_query'][0]['value'] = 'in_transit';
|
2093 |
+
$in_transit_query = new WP_Query( $query_args );
|
2094 |
+
|
2095 |
+
$query_args['meta_query'][0]['value'] = 'available_for_pickup';
|
2096 |
+
$available_for_pickup_query = new WP_Query( $query_args );
|
2097 |
+
|
2098 |
+
$query_args['meta_query'][0]['value'] = 'out_for_delivery';
|
2099 |
+
$out_for_delivery_query = new WP_Query( $query_args );
|
2100 |
+
|
2101 |
+
$query_args['meta_query'][0]['value'] = 'failed_attempt';
|
2102 |
+
$failed_attempt_query = new WP_Query( $query_args );
|
2103 |
+
|
2104 |
+
$query_args['meta_query'][0]['value'] = 'cancelled';
|
2105 |
+
$cancelled_query = new WP_Query( $query_args );
|
2106 |
+
|
2107 |
+
$query_args['meta_query'][0]['value'] = 'carrier_unsupported';
|
2108 |
+
$carrier_unsupported_query = new WP_Query( $query_args );
|
2109 |
+
|
2110 |
+
$query_args['meta_query'][0]['value'] = 'return_to_sender';
|
2111 |
+
$return_to_sender_query = new WP_Query( $query_args );
|
2112 |
+
|
2113 |
+
$query_args['meta_query'][0]['value'] = 'INVALID_TRACKING_NUM';
|
2114 |
+
$invalid_tracking_number_query = new WP_Query( $query_args );
|
2115 |
+
|
2116 |
+
return array( 'unknown' => $unknown_query->found_posts, 'pre_transit' => $pre_transit_query->found_posts, 'in_transit' => $in_transit_query->found_posts, 'available_for_pickup' => $available_for_pickup_query->found_posts, 'out_for_delivery' => $out_for_delivery_query->found_posts, 'failed_attempt' => $failed_attempt_query->found_posts, 'cancelled' => $cancelled_query->found_posts, 'carrier_unsupported' => $carrier_unsupported_query->found_posts, 'return_to_sender' => $return_to_sender_query->found_posts, 'delivered' => $delivered_query->found_posts, 'invalid_tracking_number' => $invalid_tracking_number_query->found_posts);
|
2117 |
+
}
|
2118 |
+
/**
|
2119 |
+
* Process bulk filter action for shipment status orders
|
2120 |
+
*
|
2121 |
+
* @since 3.0.0
|
2122 |
+
* @param array $vars query vars without filtering
|
2123 |
+
* @return array $vars query vars with (maybe) filtering
|
2124 |
+
*/
|
2125 |
+
public function filter_orders_by_shipment_status_query( $vars ){
|
2126 |
+
global $typenow;
|
2127 |
+
|
2128 |
+
if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] )) {
|
2129 |
+
$vars['meta_key'] = 'shipment_status';
|
2130 |
+
$vars['meta_value'] = $_GET['_shop_order_shipment_status'];
|
2131 |
+
$vars['meta_compare'] = 'LIKE';
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
return $vars;
|
2135 |
+
}
|
2136 |
}
|
includes/class-wc-advanced-shipment-tracking-api-call.php
CHANGED
@@ -105,7 +105,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
|
|
105 |
|
106 |
public function get_trackship_data( $order, $tracking_number, $tracking_provider ){
|
107 |
$user_key = get_option("wc_ast_api_key");
|
108 |
-
$domain =
|
109 |
$order_id = $order->get_id();
|
110 |
|
111 |
$url = 'https://trackship.info/wp-json/tracking/create';
|
105 |
|
106 |
public function get_trackship_data( $order, $tracking_number, $tracking_provider ){
|
107 |
$user_key = get_option("wc_ast_api_key");
|
108 |
+
$domain = get_home_url();
|
109 |
$order_id = $order->get_id();
|
110 |
|
111 |
$url = 'https://trackship.info/wp-json/tracking/create';
|
includes/class-wc-advanced-shipment-tracking-front.php
CHANGED
@@ -226,6 +226,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
226 |
$num = 1;
|
227 |
$total_trackings = sizeof($tracking_items);
|
228 |
foreach($tracking_items as $item){
|
|
|
229 |
$tracking_number = $item['tracking_number'];
|
230 |
$trackship_url = 'https://trackship.info';
|
231 |
$url = $trackship_url.'/wp-json/wc/v1/get_tracking_info_by_number';
|
@@ -254,12 +255,15 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
254 |
$trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
|
255 |
}
|
256 |
|
257 |
-
|
258 |
-
//Get the day of the week using PHP's date function.
|
259 |
-
$day = date("l", $unixTimestamp);
|
260 |
if(!empty($tracking_detail_org)){
|
261 |
-
//echo '<pre>';print_r($tracking_detail_org);echo '</pre>';
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
|
264 |
if($tracker->ep_status == "return_to_sender" ){
|
265 |
$state2_class = 'return_to_sender';
|
@@ -280,7 +284,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
280 |
<div class="tracking-header">
|
281 |
<div class="col-md col-md-6">
|
282 |
<?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
|
283 |
-
<?php
|
284 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
|
285 |
</div>
|
286 |
<div class="col-md col-md-6">
|
@@ -594,7 +598,7 @@ class WC_Advanced_Shipment_Tracking_Front {
|
|
594 |
<div class="tracking-header">
|
595 |
<div class="col-md col-md-6">
|
596 |
<?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
|
597 |
-
<?php
|
598 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
|
599 |
</div>
|
600 |
<div class="col-md col-md-6">
|
@@ -813,7 +817,7 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
|
|
813 |
<div class="tracking-header">
|
814 |
<div class="col-md col-md-6">
|
815 |
Order: <span class="tracking-number">#4542</span><br>
|
816 |
-
|
817 |
<h1 class="shipment_status_heading text-success">Delivered</h1>
|
818 |
</div>
|
819 |
<div class="col-md col-md-6">
|
226 |
$num = 1;
|
227 |
$total_trackings = sizeof($tracking_items);
|
228 |
foreach($tracking_items as $item){
|
229 |
+
|
230 |
$tracking_number = $item['tracking_number'];
|
231 |
$trackship_url = 'https://trackship.info';
|
232 |
$url = $trackship_url.'/wp-json/wc/v1/get_tracking_info_by_number';
|
255 |
$trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
|
256 |
}
|
257 |
|
258 |
+
|
|
|
|
|
259 |
if(!empty($tracking_detail_org)){
|
|
|
260 |
|
261 |
+
if($tracker->est_delivery_date){
|
262 |
+
$unixTimestamp = strtotime($tracker->est_delivery_date);
|
263 |
+
$day = date("l", $unixTimestamp);
|
264 |
+
}
|
265 |
+
|
266 |
+
//echo '<pre>';print_r($tracker->carrier);echo '</pre>';
|
267 |
if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
|
268 |
if($tracker->ep_status == "return_to_sender" ){
|
269 |
$state2_class = 'return_to_sender';
|
284 |
<div class="tracking-header">
|
285 |
<div class="col-md col-md-6">
|
286 |
<?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
|
287 |
+
<?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
|
288 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
|
289 |
</div>
|
290 |
<div class="col-md col-md-6">
|
598 |
<div class="tracking-header">
|
599 |
<div class="col-md col-md-6">
|
600 |
<?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
|
601 |
+
<?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
|
602 |
<h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
|
603 |
</div>
|
604 |
<div class="col-md col-md-6">
|
817 |
<div class="tracking-header">
|
818 |
<div class="col-md col-md-6">
|
819 |
Order: <span class="tracking-number">#4542</span><br>
|
820 |
+
USPS: <span class="tracking-number">9405511899561468285343</span>
|
821 |
<h1 class="shipment_status_heading text-success">Delivered</h1>
|
822 |
</div>
|
823 |
<div class="col-md col-md-6">
|
includes/class-wc-advanced-shipment-tracking-install.php
CHANGED
@@ -127,7 +127,7 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
127 |
"shipping_default" => $shipping_provider['shipping_default'],
|
128 |
));
|
129 |
}
|
130 |
-
update_option( 'wc_advanced_shipment_tracking', '
|
131 |
}
|
132 |
}
|
133 |
/**
|
@@ -234,9 +234,9 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
234 |
),
|
235 |
|
236 |
12 => array (
|
237 |
-
"provider_name" => 'Hermes',
|
238 |
-
"ts_slug" => 'hermes',
|
239 |
-
"provider_url" => 'https://
|
240 |
"shipping_country" => 'DE',
|
241 |
"shipping_default" => '1'
|
242 |
),
|
@@ -914,8 +914,23 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
914 |
"provider_url" => 'https://www.deppon.com/en/toTrack.action',
|
915 |
"shipping_country" => 'CN',
|
916 |
"shipping_default" => '1',
|
917 |
-
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
918 |
);
|
|
|
919 |
return $providers;
|
920 |
}
|
921 |
/*
|
@@ -1428,8 +1443,117 @@ class WC_Advanced_Shipment_Tracking_Install {
|
|
1428 |
|
1429 |
update_option( 'wc_advanced_shipment_tracking', '2.9');
|
1430 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
}
|
1432 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1433 |
/*
|
1434 |
* Display admin notice on plugin install or update
|
1435 |
*/
|
127 |
"shipping_default" => $shipping_provider['shipping_default'],
|
128 |
));
|
129 |
}
|
130 |
+
update_option( 'wc_advanced_shipment_tracking', '3.1');
|
131 |
}
|
132 |
}
|
133 |
/**
|
234 |
),
|
235 |
|
236 |
12 => array (
|
237 |
+
"provider_name" => 'Hermes Germany',
|
238 |
+
"ts_slug" => 'hermes-de',
|
239 |
+
"provider_url" => 'https://www.myhermes.de/empfangen/sendungsverfolgung/?suche=%number%',
|
240 |
"shipping_country" => 'DE',
|
241 |
"shipping_default" => '1'
|
242 |
),
|
914 |
"provider_url" => 'https://www.deppon.com/en/toTrack.action',
|
915 |
"shipping_country" => 'CN',
|
916 |
"shipping_default" => '1',
|
917 |
+
),
|
918 |
+
106 => array (
|
919 |
+
"provider_name" => 'GLS Italy',
|
920 |
+
"ts_slug" => 'gls-italy',
|
921 |
+
"provider_url" => 'https://www.gls-italy.com/?option=com_gls&view=track_e_trace&mode=search&numero_spedizione=%number%&tipo_codice=nazionale',
|
922 |
+
"shipping_country" => 'IT',
|
923 |
+
"shipping_default" => '1',
|
924 |
+
),
|
925 |
+
107 => array (
|
926 |
+
"provider_name" => 'Hermes World',
|
927 |
+
"ts_slug" => 'hermes',
|
928 |
+
"provider_url" => 'https://new.myhermes.co.uk/track.html#/parcel/%number%/details',
|
929 |
+
"shipping_country" => 'Global',
|
930 |
+
"shipping_default" => '1',
|
931 |
+
),
|
932 |
);
|
933 |
+
|
934 |
return $providers;
|
935 |
}
|
936 |
/*
|
1443 |
|
1444 |
update_option( 'wc_advanced_shipment_tracking', '2.9');
|
1445 |
}
|
1446 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.0', '<') ){
|
1447 |
+
global $wpdb;
|
1448 |
+
$new_providers = array (
|
1449 |
+
1 => array (
|
1450 |
+
"provider_name" => 'GLS Italy',
|
1451 |
+
"ts_slug" => 'gls-italy',
|
1452 |
+
"provider_url" => 'https://www.gls-italy.com/?option=com_gls&view=track_e_trace&mode=search&numero_spedizione=%number%&tipo_codice=nazionale',
|
1453 |
+
"shipping_country" => 'IT',
|
1454 |
+
"shipping_default" => '1',
|
1455 |
+
"display_in_order" => 0,
|
1456 |
+
)
|
1457 |
+
);
|
1458 |
+
|
1459 |
+
foreach($new_providers as $provider){
|
1460 |
+
$success = $wpdb->insert($this->table, array(
|
1461 |
+
"provider_name" => $provider['provider_name'],
|
1462 |
+
"ts_slug" => $provider['ts_slug'],
|
1463 |
+
"provider_url" => $provider['provider_url'],
|
1464 |
+
"shipping_country" => $provider['shipping_country'],
|
1465 |
+
"shipping_default" => $provider['shipping_default'],
|
1466 |
+
"display_in_order" => $provider['display_in_order'],
|
1467 |
+
));
|
1468 |
+
}
|
1469 |
+
update_option( 'wc_advanced_shipment_tracking', '3.0');
|
1470 |
+
}
|
1471 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.1', '<') ){
|
1472 |
+
$this->update_shipping_providers();
|
1473 |
+
update_option( 'wc_advanced_shipment_tracking', '3.1');
|
1474 |
+
}
|
1475 |
}
|
1476 |
}
|
1477 |
+
|
1478 |
+
public function update_shipping_providers(){
|
1479 |
+
global $wpdb;
|
1480 |
+
$url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
|
1481 |
+
$resp = wp_remote_get( $url );
|
1482 |
+
$providers = json_decode($resp['body'],true);
|
1483 |
+
|
1484 |
+
$providers_name = array();
|
1485 |
+
|
1486 |
+
$default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
|
1487 |
+
|
1488 |
+
foreach ( $default_shippment_providers as $key => $val ){
|
1489 |
+
$shippment_providers[ $val->provider_name ] = $val;
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
foreach ( $providers as $key => $val ){
|
1493 |
+
$providers_name[ $val['provider_name'] ] = $val;
|
1494 |
+
}
|
1495 |
+
//echo '<pre>';print_r($providers_name);echo '</pre>';exit;
|
1496 |
+
|
1497 |
+
foreach($providers as $provider){
|
1498 |
+
|
1499 |
+
$provider_name = $provider['shipping_provider'];
|
1500 |
+
$provider_url = $provider['provider_url'];
|
1501 |
+
$shipping_country = $provider['shipping_country'];
|
1502 |
+
$ts_slug = $provider['shipping_provider_slug'];
|
1503 |
+
|
1504 |
+
if($shippment_providers[$provider_name]){
|
1505 |
+
$db_provider_url = $shippment_providers[$provider_name]->provider_url;
|
1506 |
+
$db_shipping_country = $shippment_providers[$provider_name]->shipping_country;
|
1507 |
+
$db_ts_slug = $shippment_providers[$provider_name]->ts_slug;
|
1508 |
+
if(($db_provider_url != $provider_url) || ($db_shipping_country != $shipping_country) || ($db_ts_slug != $ts_slug)){
|
1509 |
+
$data_array = array(
|
1510 |
+
'ts_slug' => $ts_slug,
|
1511 |
+
'provider_url' => $provider_url,
|
1512 |
+
'shipping_country' => $shipping_country,
|
1513 |
+
);
|
1514 |
+
$where_array = array(
|
1515 |
+
'provider_name' => $provider_name,
|
1516 |
+
);
|
1517 |
+
$wpdb->update( $this->table, $data_array, $where_array);
|
1518 |
+
}
|
1519 |
+
} else{
|
1520 |
+
$img_url = $provider['img_url'];
|
1521 |
+
$img_slug = sanitize_title($provider_name);
|
1522 |
+
$img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
|
1523 |
+
|
1524 |
+
$ch = curl_init();
|
1525 |
+
|
1526 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1527 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1528 |
+
curl_setopt($ch, CURLOPT_URL, $img_url);
|
1529 |
+
|
1530 |
+
$data = curl_exec($ch);
|
1531 |
+
curl_close($ch);
|
1532 |
+
|
1533 |
+
file_put_contents($img, $data);
|
1534 |
+
|
1535 |
+
|
1536 |
+
$data_array = array(
|
1537 |
+
'shipping_country' => sanitize_text_field($shipping_country),
|
1538 |
+
'provider_name' => sanitize_text_field($provider_name),
|
1539 |
+
'ts_slug' => $ts_slug,
|
1540 |
+
'provider_url' => sanitize_text_field($provider_url),
|
1541 |
+
'display_in_order' => 0,
|
1542 |
+
'shipping_default' => 1,
|
1543 |
+
);
|
1544 |
+
$result = $wpdb->insert( $this->table, $data_array );
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
+
foreach($default_shippment_providers as $db_provider){
|
1548 |
+
if(!is_array($providers_name[$db_provider->provider_name])){
|
1549 |
+
$where = array(
|
1550 |
+
'provider_name' => $db_provider->provider_name,
|
1551 |
+
'shipping_default' => 1
|
1552 |
+
);
|
1553 |
+
$wpdb->delete( $this->table, $where );
|
1554 |
+
}
|
1555 |
+
}
|
1556 |
+
}
|
1557 |
/*
|
1558 |
* Display admin notice on plugin install or update
|
1559 |
*/
|
includes/class-wc-advanced-shipment-tracking.php
CHANGED
@@ -169,7 +169,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
169 |
|
170 |
$shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
|
171 |
|
172 |
-
$default_provider = get_option("wc_ast_default_provider" );
|
|
|
173 |
|
174 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
175 |
if($wc_ast_status_shipped == 1){
|
@@ -216,7 +217,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
216 |
?>
|
217 |
<p class="form-field change_order_to_shipped_field ">
|
218 |
<label for="change_order_to_shipped"><?php _e( 'Change order to Shipped?', 'woo-advanced-shipment-tracking'); ?></label>
|
219 |
-
<input type="checkbox" class="checkbox" style="" name="change_order_to_shipped" id="change_order_to_shipped" value="yes"
|
220 |
</p>
|
221 |
<p class="" style="text-align:left;">
|
222 |
<input type="hidden" name="action" value="add_inline_tracking_number">
|
@@ -242,7 +243,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
242 |
*/
|
243 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
244 |
$formatted = $this->get_formatted_tracking_item( $order_id, $item );
|
245 |
-
//echo '<pre>';print_r($
|
246 |
?>
|
247 |
<div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
|
248 |
<p class="tracking-content">
|
@@ -333,6 +334,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
333 |
$shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
|
334 |
|
335 |
$default_provider = get_option("wc_ast_default_provider" );
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
338 |
if($wc_ast_status_shipped == 1){
|
@@ -406,8 +413,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
406 |
woocommerce_wp_checkbox( array(
|
407 |
'id' => 'change_order_to_shipped',
|
408 |
'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
|
409 |
-
'description' => '',
|
410 |
-
'
|
|
|
411 |
) );
|
412 |
|
413 |
echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
|
@@ -866,8 +874,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
|
|
866 |
$tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
|
867 |
}
|
868 |
if($args['date_shipped']){
|
869 |
-
$
|
|
|
|
|
|
|
|
|
870 |
}
|
|
|
871 |
if($args['status_shipped']){
|
872 |
$tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
|
873 |
}
|
169 |
|
170 |
$shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
|
171 |
|
172 |
+
$default_provider = get_option("wc_ast_default_provider" );
|
173 |
+
$wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
|
174 |
|
175 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
176 |
if($wc_ast_status_shipped == 1){
|
217 |
?>
|
218 |
<p class="form-field change_order_to_shipped_field ">
|
219 |
<label for="change_order_to_shipped"><?php _e( 'Change order to Shipped?', 'woo-advanced-shipment-tracking'); ?></label>
|
220 |
+
<input type="checkbox" class="checkbox" style="" name="change_order_to_shipped" id="change_order_to_shipped" value="yes" <?php if($wc_ast_default_mark_shipped == 1){ echo 'checked'; }?>>
|
221 |
</p>
|
222 |
<p class="" style="text-align:left;">
|
223 |
<input type="hidden" name="action" value="add_inline_tracking_number">
|
243 |
*/
|
244 |
public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
|
245 |
$formatted = $this->get_formatted_tracking_item( $order_id, $item );
|
246 |
+
//echo '<pre>';print_r($item);echo '</pre>';
|
247 |
?>
|
248 |
<div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
|
249 |
<p class="tracking-content">
|
334 |
$shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
|
335 |
|
336 |
$default_provider = get_option("wc_ast_default_provider" );
|
337 |
+
$wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
|
338 |
+
$value = 1;
|
339 |
+
$cbvalue = '';
|
340 |
+
if($wc_ast_default_mark_shipped == 1){
|
341 |
+
$cbvalue = 1;
|
342 |
+
}
|
343 |
|
344 |
$wc_ast_status_shipped = get_option('wc_ast_status_shipped');
|
345 |
if($wc_ast_status_shipped == 1){
|
413 |
woocommerce_wp_checkbox( array(
|
414 |
'id' => 'change_order_to_shipped',
|
415 |
'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
|
416 |
+
'description' => '',
|
417 |
+
'cbvalue' => $cbvalue,
|
418 |
+
'value' => $value,
|
419 |
) );
|
420 |
|
421 |
echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
|
874 |
$tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
|
875 |
}
|
876 |
if($args['date_shipped']){
|
877 |
+
$date = str_replace("/","-",$args['date_shipped']);
|
878 |
+
$date = date_create($date);
|
879 |
+
$date = date_format($date,"d-m-Y");
|
880 |
+
|
881 |
+
$tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
|
882 |
}
|
883 |
+
|
884 |
if($args['status_shipped']){
|
885 |
$tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
|
886 |
}
|
includes/customizer/class-wc-availableforpickup-email-customizer.php
CHANGED
@@ -482,7 +482,7 @@ class wcast_availableforpickup_customizer_email {
|
|
482 |
}
|
483 |
// create a new email
|
484 |
$email = new WC_Email();
|
485 |
-
|
486 |
//echo '<pre>';print_r($email);echo '</pre>';
|
487 |
// wrap the content with the email template and then add styles
|
488 |
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
482 |
}
|
483 |
// create a new email
|
484 |
$email = new WC_Email();
|
485 |
+
$email->id = 'WC_Delivered_email';
|
486 |
//echo '<pre>';print_r($email);echo '</pre>';
|
487 |
// wrap the content with the email template and then add styles
|
488 |
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
includes/customizer/class-wc-email-customizer.php
CHANGED
@@ -208,8 +208,8 @@ class wcast_initialise_customizer_email {
|
|
208 |
);
|
209 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[recipient]',
|
210 |
array(
|
211 |
-
'label' => __( '
|
212 |
-
'description' => esc_html__( 'Enter emails
|
213 |
'section' => 'customer_delivered_email',
|
214 |
'type' => 'text',
|
215 |
'input_attrs' => array(
|
@@ -232,7 +232,7 @@ class wcast_initialise_customizer_email {
|
|
232 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[subject]',
|
233 |
array(
|
234 |
'label' => __( 'Email subject', 'woo-advanced-shipment-tracking' ),
|
235 |
-
'description' => esc_html__( 'Available
|
236 |
'section' => 'customer_delivered_email',
|
237 |
'type' => 'text',
|
238 |
'input_attrs' => array(
|
@@ -255,7 +255,7 @@ class wcast_initialise_customizer_email {
|
|
255 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[heading]',
|
256 |
array(
|
257 |
'label' => __( 'Email heading', 'woo-advanced-shipment-tracking' ),
|
258 |
-
'description' => esc_html__( 'Available
|
259 |
'section' => 'customer_delivered_email',
|
260 |
'type' => 'text',
|
261 |
'input_attrs' => array(
|
@@ -266,6 +266,27 @@ class wcast_initialise_customizer_email {
|
|
266 |
)
|
267 |
);
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
// Display Shipment Provider image/thumbnail
|
270 |
$wp_customize->add_setting( 'wcast_show_tracking_details',
|
271 |
array(
|
@@ -276,7 +297,7 @@ class wcast_initialise_customizer_email {
|
|
276 |
);
|
277 |
$wp_customize->add_control( 'wcast_show_tracking_details',
|
278 |
array(
|
279 |
-
'label' => __( '
|
280 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
281 |
'section' => 'customer_delivered_email',
|
282 |
'type' => 'checkbox'
|
@@ -292,23 +313,24 @@ class wcast_initialise_customizer_email {
|
|
292 |
);
|
293 |
$wp_customize->add_control( 'wcast_show_order_details',
|
294 |
array(
|
295 |
-
'label' => __( '
|
296 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
297 |
'section' => 'customer_delivered_email',
|
298 |
'type' => 'checkbox'
|
299 |
)
|
300 |
);
|
|
|
301 |
// Display Shipment Provider image/thumbnail
|
302 |
-
$wp_customize->add_setting( '
|
303 |
array(
|
304 |
-
'default' => $this->defaults['
|
305 |
'transport' => 'refresh',
|
306 |
'sanitize_callback' => ''
|
307 |
)
|
308 |
);
|
309 |
-
$wp_customize->add_control( '
|
310 |
array(
|
311 |
-
'label' => __( '
|
312 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
313 |
'section' => 'customer_delivered_email',
|
314 |
'type' => 'checkbox'
|
@@ -316,41 +338,39 @@ class wcast_initialise_customizer_email {
|
|
316 |
);
|
317 |
|
318 |
// Display Shipment Provider image/thumbnail
|
319 |
-
$wp_customize->add_setting( '
|
320 |
array(
|
321 |
-
'default' => $this->defaults['
|
322 |
'transport' => 'refresh',
|
323 |
'sanitize_callback' => ''
|
324 |
)
|
325 |
);
|
326 |
-
$wp_customize->add_control( '
|
327 |
array(
|
328 |
-
'label' => __( '
|
329 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
330 |
'section' => 'customer_delivered_email',
|
331 |
'type' => 'checkbox'
|
332 |
)
|
333 |
);
|
334 |
-
|
335 |
-
//
|
336 |
-
$wp_customize->add_setting( '
|
337 |
array(
|
338 |
-
'default' =>
|
339 |
'transport' => 'refresh',
|
340 |
-
'sanitize_callback' => '
|
341 |
)
|
342 |
);
|
343 |
-
$wp_customize->add_control(
|
344 |
array(
|
345 |
-
'label' => __( '
|
346 |
-
'description' =>
|
347 |
'section' => 'customer_delivered_email',
|
348 |
-
'
|
349 |
-
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
350 |
-
'mediaButtons' => true,
|
351 |
-
)
|
352 |
)
|
353 |
-
)
|
|
|
354 |
|
355 |
$wp_customize->add_setting( 'wcast_delivered_analytics_link',
|
356 |
array(
|
@@ -362,7 +382,7 @@ class wcast_initialise_customizer_email {
|
|
362 |
$wp_customize->add_control( 'wcast_delivered_analytics_link',
|
363 |
array(
|
364 |
'label' => __( 'Google Analytics link tracking', 'woo-advanced-shipment-tracking' ),
|
365 |
-
'description' => esc_html__( 'This will be appended to URL in the email content', 'woo-advanced-shipment-tracking' ),
|
366 |
'section' => 'customer_delivered_email',
|
367 |
'type' => 'text',
|
368 |
'input_attrs' => array(
|
208 |
);
|
209 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[recipient]',
|
210 |
array(
|
211 |
+
'label' => __( 'Receipts', 'woo-advanced-shipment-tracking' ),
|
212 |
+
'description' => esc_html__( 'Enter emails use variables such as {customer_email}. Multiple emails can be separated by commas.', 'woo-advanced-shipment-tracking' ),
|
213 |
'section' => 'customer_delivered_email',
|
214 |
'type' => 'text',
|
215 |
'input_attrs' => array(
|
232 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[subject]',
|
233 |
array(
|
234 |
'label' => __( 'Email subject', 'woo-advanced-shipment-tracking' ),
|
235 |
+
'description' => esc_html__( 'Available variables: {site_title}, {order_number}', 'woo-advanced-shipment-tracking' ),
|
236 |
'section' => 'customer_delivered_email',
|
237 |
'type' => 'text',
|
238 |
'input_attrs' => array(
|
255 |
$wp_customize->add_control( 'woocommerce_customer_delivered_order_settings[heading]',
|
256 |
array(
|
257 |
'label' => __( 'Email heading', 'woo-advanced-shipment-tracking' ),
|
258 |
+
'description' => esc_html__( 'Available variables: {site_title}, {order_number}', 'woo-advanced-shipment-tracking' ),
|
259 |
'section' => 'customer_delivered_email',
|
260 |
'type' => 'text',
|
261 |
'input_attrs' => array(
|
266 |
)
|
267 |
);
|
268 |
|
269 |
+
|
270 |
+
// Test of TinyMCE control
|
271 |
+
$wp_customize->add_setting( 'wcast_delivered_email_content',
|
272 |
+
array(
|
273 |
+
'default' => $this->defaults['wcast_delivered_email_content'],
|
274 |
+
'transport' => 'refresh',
|
275 |
+
'sanitize_callback' => 'wp_kses_post'
|
276 |
+
)
|
277 |
+
);
|
278 |
+
$wp_customize->add_control( new Skyrocket_TinyMCE_Custom_control( $wp_customize, 'wcast_delivered_email_content',
|
279 |
+
array(
|
280 |
+
'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
|
281 |
+
'description' => __( 'available variables: {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}', 'woo-advanced-shipment-tracking' ),
|
282 |
+
'section' => 'customer_delivered_email',
|
283 |
+
'input_attrs' => array(
|
284 |
+
'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
|
285 |
+
'mediaButtons' => true,
|
286 |
+
)
|
287 |
+
)
|
288 |
+
) );
|
289 |
+
|
290 |
// Display Shipment Provider image/thumbnail
|
291 |
$wp_customize->add_setting( 'wcast_show_tracking_details',
|
292 |
array(
|
297 |
);
|
298 |
$wp_customize->add_control( 'wcast_show_tracking_details',
|
299 |
array(
|
300 |
+
'label' => __( 'Display tracking details', 'woo-advanced-shipment-tracking' ),
|
301 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
302 |
'section' => 'customer_delivered_email',
|
303 |
'type' => 'checkbox'
|
313 |
);
|
314 |
$wp_customize->add_control( 'wcast_show_order_details',
|
315 |
array(
|
316 |
+
'label' => __( 'Display order details', 'woo-advanced-shipment-tracking' ),
|
317 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
318 |
'section' => 'customer_delivered_email',
|
319 |
'type' => 'checkbox'
|
320 |
)
|
321 |
);
|
322 |
+
|
323 |
// Display Shipment Provider image/thumbnail
|
324 |
+
$wp_customize->add_setting( 'wcast_show_shipping_address',
|
325 |
array(
|
326 |
+
'default' => $this->defaults['wcast_show_shipping_address'],
|
327 |
'transport' => 'refresh',
|
328 |
'sanitize_callback' => ''
|
329 |
)
|
330 |
);
|
331 |
+
$wp_customize->add_control( 'wcast_show_shipping_address',
|
332 |
array(
|
333 |
+
'label' => __( 'Display Shipping Address', 'woo-advanced-shipment-tracking' ),
|
334 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
335 |
'section' => 'customer_delivered_email',
|
336 |
'type' => 'checkbox'
|
338 |
);
|
339 |
|
340 |
// Display Shipment Provider image/thumbnail
|
341 |
+
$wp_customize->add_setting( 'wcast_show_billing_address',
|
342 |
array(
|
343 |
+
'default' => $this->defaults['wcast_show_billing_address'],
|
344 |
'transport' => 'refresh',
|
345 |
'sanitize_callback' => ''
|
346 |
)
|
347 |
);
|
348 |
+
$wp_customize->add_control( 'wcast_show_billing_address',
|
349 |
array(
|
350 |
+
'label' => __( 'Display Billing Address', 'woo-advanced-shipment-tracking' ),
|
351 |
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
352 |
'section' => 'customer_delivered_email',
|
353 |
'type' => 'checkbox'
|
354 |
)
|
355 |
);
|
356 |
+
|
357 |
+
// Display Shipment Provider image/thumbnail
|
358 |
+
$wp_customize->add_setting( 'wcast_enable_delivered_ga_tracking',
|
359 |
array(
|
360 |
+
'default' => '',
|
361 |
'transport' => 'refresh',
|
362 |
+
'sanitize_callback' => ''
|
363 |
)
|
364 |
);
|
365 |
+
$wp_customize->add_control( 'wcast_enable_delivered_ga_tracking',
|
366 |
array(
|
367 |
+
'label' => __( 'Enable Google Analytics tracking', 'woo-advanced-shipment-tracking' ),
|
368 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
369 |
'section' => 'customer_delivered_email',
|
370 |
+
'type' => 'checkbox'
|
|
|
|
|
|
|
371 |
)
|
372 |
+
);
|
373 |
+
|
374 |
|
375 |
$wp_customize->add_setting( 'wcast_delivered_analytics_link',
|
376 |
array(
|
382 |
$wp_customize->add_control( 'wcast_delivered_analytics_link',
|
383 |
array(
|
384 |
'label' => __( 'Google Analytics link tracking', 'woo-advanced-shipment-tracking' ),
|
385 |
+
'description' => esc_html__( 'This will be appended to URL in the email content – e.g. utm_source=ast&utm_medium=email&utm_campaign=delivered', 'woo-advanced-shipment-tracking' ),
|
386 |
'section' => 'customer_delivered_email',
|
387 |
'type' => 'text',
|
388 |
'input_attrs' => array(
|
includes/emails/class-shipment-delivered-email.php
CHANGED
@@ -141,9 +141,10 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
|
|
141 |
|
142 |
$message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
|
143 |
|
|
|
144 |
$wcast_delivered_analytics_link = get_theme_mod('wcast_delivered_analytics_link');
|
145 |
|
146 |
-
if($wcast_delivered_analytics_link){
|
147 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
148 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
149 |
}
|
141 |
|
142 |
$message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
|
143 |
|
144 |
+
$wcast_enable_delivered_ga_tracking = get_theme_mod('wcast_enable_delivered_ga_tracking');
|
145 |
$wcast_delivered_analytics_link = get_theme_mod('wcast_delivered_analytics_link');
|
146 |
|
147 |
+
if($wcast_delivered_analytics_link && $wcast_enable_delivered_ga_tracking == 1){
|
148 |
$regex = '#(<a href=")([^"]*)("[^>]*?>)#i';
|
149 |
$message = preg_replace_callback($regex, array( $this, '_appendCampaignToString'), $message);
|
150 |
}
|
includes/views/admin_options_bulk_upload.php
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
<hr>
|
34 |
<p><?php _e('You can download an example of the csv file:', 'woo-advanced-shipment-tracking'); ?></p>
|
35 |
<a class="button-primary btn_green2" href="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>/assets/tracking.csv"><?php _e('Download sample csv file', 'woo-advanced-shipment-tracking'); ?></a>
|
36 |
-
|
37 |
<div id="p1" class="mdl-progress mdl-js-progress" style="display:none;"></div>
|
38 |
<h3 class="progress_title" style="display:none;"><?php _e('Upload Progress - ', 'woo-advanced-shipment-tracking'); ?><span class="progress_number"></span></h3>
|
39 |
<ol class="csv_upload_status">
|
33 |
<hr>
|
34 |
<p><?php _e('You can download an example of the csv file:', 'woo-advanced-shipment-tracking'); ?></p>
|
35 |
<a class="button-primary btn_green2" href="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>/assets/tracking.csv"><?php _e('Download sample csv file', 'woo-advanced-shipment-tracking'); ?></a>
|
36 |
+
<p><?php _e('For detailed instructions on how to upload tracking info in bulk, see our', 'woo-advanced-shipment-tracking'); ?> <a class="" href="https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/bulk-import-shipment-tracking/" target="blank"><?php _e('documentation', 'woo-advanced-shipment-tracking'); ?></a>.</p>
|
37 |
<div id="p1" class="mdl-progress mdl-js-progress" style="display:none;"></div>
|
38 |
<h3 class="progress_title" style="display:none;"><?php _e('Upload Progress - ', 'woo-advanced-shipment-tracking'); ?><span class="progress_number"></span></h3>
|
39 |
<ol class="csv_upload_status">
|
includes/views/admin_options_settings (Eran Shor's conflicted copy 2019-08-07).php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<section id="content2" class="tab_section">
|
2 |
-
<div class="tab_inner_container">
|
3 |
-
<form method="post" id="wc_ast_settings_form" action="" enctype="multipart/form-data">
|
4 |
-
<?php #nonce?>
|
5 |
-
|
6 |
-
<input id="tab9" type="radio" name="pagetabs" class="tab_input_1" checked>
|
7 |
-
<label for="tab9"><?php _e( 'General', 'woo-advanced-shipment-tracking' ); ?></label>
|
8 |
-
<span style="margin: 0 3px;">|</span>
|
9 |
-
<input id="tab10" type="radio" class="tab_input_1" name="pagetabs" <?php if(isset($_GET['tab']) && $_GET['tab'] == 'delivered-order-status'){ echo 'checked'; } ?>>
|
10 |
-
<label for="tab10"><?php _e( 'Delivered Order Status', 'woo-advanced-shipment-tracking' ); ?></label>
|
11 |
-
<span style="margin: 0 3px;">|</span>
|
12 |
-
<label style="vertical-align: top;"><a style="text-decoration: none;" href="<?php echo wcast_initialise_customizer_settings::get_customizer_url('default_controls_section','settings') ?>" class=""><?php _e( 'Tracking Info Display Designer', 'woo-advanced-shipment-tracking' ); ?> <span class="dashicons dashicons-welcome-view-site"></span> </a></label>
|
13 |
-
<br class="clear">
|
14 |
-
<section id="content9" class="tpage_section">
|
15 |
-
<h3><?php _e( 'General Settings', 'woo-advanced-shipment-tracking' ); ?></h3>
|
16 |
-
<?php $this->get_html( $this->get_settings_data() );?>
|
17 |
-
</section>
|
18 |
-
<section id="content10" class="tpage_section">
|
19 |
-
<h3><?php _e( 'Delivered Order Status', 'woo-advanced-shipment-tracking' ); ?></h3>
|
20 |
-
<?php $this->get_html( $this->get_delivered_data() );?>
|
21 |
-
<p><?php echo sprintf(__('<strong>PLEASE NOTE</strong> - If you use the custom order status "Delivered", when you deactivate the plugin, you must register this order status in function.php in order to see these orders in the orders admin. You can find the <a href="%s" target="blank">snippet</a> to use in functions.php here or you can manually change all your "delivered" order to "completed" before deactivating the plugin.', 'woo-advanced-shipment-tracking'), 'https://gist.github.com/zorem/6f09162fe91eab180a76a621ce523441'); ?></p>
|
22 |
-
</section>
|
23 |
-
<div class="submit">
|
24 |
-
<button name="save" class="button-primary woocommerce-save-button btn_green" type="submit" value="Save changes"><?php _e( 'Save', 'woo-advanced-shipment-tracking' ); ?></button>
|
25 |
-
<div class="spinner" style="float:none"></div>
|
26 |
-
<div class="success_msg" style="display:none;"><?php _e( 'Data saved successfully.', 'woo-advanced-shipment-tracking' ); ?></div>
|
27 |
-
<div class="error_msg" style="display:none;"></div>
|
28 |
-
<?php wp_nonce_field( 'wc_ast_settings_form', 'wc_ast_settings_form' );?>
|
29 |
-
<input type="hidden" name="action" value="wc_ast_settings_form_update">
|
30 |
-
</div>
|
31 |
-
</form>
|
32 |
-
</div>
|
33 |
-
<?php include 'zorem_admin_sidebar.php';?>
|
34 |
-
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/views/admin_options_shipping_provider.php
CHANGED
@@ -13,10 +13,8 @@
|
|
13 |
<span class="dashicons dashicons-admin-generic dropdown_menu"></span>
|
14 |
</div>
|
15 |
<ul class="dropdown-content">
|
16 |
-
<li><a href="javaScript:void(0);" class="add_custom_provider" id="add-custom">Add Custom Provider</a></li>
|
17 |
-
|
18 |
-
<li><a href="javaScript:void(0);" class="sync_providers">Sync Provider List</a></li>
|
19 |
-
<?php } ?>
|
20 |
<li>Reset <a href="javaScript:void(0);" class="reset_active">active</a> | <a href="javaScript:void(0);" class="reset_inactive">inactive</a></li>
|
21 |
</ul>
|
22 |
<div class="search_section">
|
13 |
<span class="dashicons dashicons-admin-generic dropdown_menu"></span>
|
14 |
</div>
|
15 |
<ul class="dropdown-content">
|
16 |
+
<li><a href="javaScript:void(0);" class="add_custom_provider" id="add-custom">Add Custom Provider</a></li>
|
17 |
+
<li><a href="javaScript:void(0);" class="sync_providers">Sync Provider List</a></li>
|
|
|
|
|
18 |
<li>Reset <a href="javaScript:void(0);" class="reset_active">active</a> | <a href="javaScript:void(0);" class="reset_inactive">inactive</a></li>
|
19 |
</ul>
|
20 |
<div class="search_section">
|
readme.txt
CHANGED
@@ -12,20 +12,22 @@ Add shipment tracking information to your WooCommerce orders and provide your cu
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
Add shipment tracking information to your WooCommerce orders and provide your customers with an easy way to track their orders.
|
16 |
|
17 |
-
Shop managers
|
18 |
|
19 |
-
|
20 |
|
21 |
== Features ==
|
22 |
|
23 |
-
* Add shipment tracking info to orders –
|
24 |
* Add multiple tracking numbers to orders
|
25 |
-
*
|
|
|
26 |
* Select shipping providers to use when adding tracking info to orders
|
27 |
* Set the default provider when adding tracking info to orders
|
28 |
* Add custom shipping providers
|
|
|
29 |
* Display Shipment tracking info and tracking link on user accounts
|
30 |
* Display Shipment tracking info and tracking link on customer emails
|
31 |
* Customize and preview the Tracking info display on customer emails using email designer.
|
@@ -39,7 +41,17 @@ Use WooCommerce Advanced Shipment Tracking to streamline your order management,
|
|
39 |
|
40 |
== TrackShip Integration==
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
== Localization ==
|
45 |
|
@@ -64,7 +76,7 @@ Hebrew, Hindi, Italian, Norwegian (Bokmål), Russian, Swedish, Turkish, Bulgaria
|
|
64 |
* [WooCommerce PDF Invoices & Packing Slips plugin](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips).
|
65 |
|
66 |
|
67 |
-
https://www.youtube.com/watch?v=
|
68 |
|
69 |
== Frequently Asked Questions ==
|
70 |
|
@@ -106,6 +118,21 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
|
|
106 |
|
107 |
== Changelog ==
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
= 2.3.8 =
|
110 |
* Fixed - Trackship connection issue when trackship setting saved
|
111 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Add shipment tracking information to your WooCommerce orders and provide your customers with an easy way to track their orders.
|
16 |
|
17 |
+
This plugin provide Shop managers easy ways to add shipment tracking information to order, once the order is Completed (Shipped) the customer will receive the tracking details and a link to tracker their order in the order emails and on my account section.
|
18 |
|
19 |
+
AST provide a list of 100+ shipping providers with pre-set tracking link and image, you can add your own custom provider, customize the tracking display, created delivered order status, customize the emails and more.
|
20 |
|
21 |
== Features ==
|
22 |
|
23 |
+
* Add shipment tracking info to orders – shipping provider, tracking number and shipping date
|
24 |
* Add multiple tracking numbers to orders
|
25 |
+
* Add tracking info to orders from the orders admin (inline)
|
26 |
+
* List of 100+ default shipping providers (carriers)
|
27 |
* Select shipping providers to use when adding tracking info to orders
|
28 |
* Set the default provider when adding tracking info to orders
|
29 |
* Add custom shipping providers
|
30 |
+
* Sync the Providers list with TrackShip
|
31 |
* Display Shipment tracking info and tracking link on user accounts
|
32 |
* Display Shipment tracking info and tracking link on customer emails
|
33 |
* Customize and preview the Tracking info display on customer emails using email designer.
|
41 |
|
42 |
== TrackShip Integration==
|
43 |
|
44 |
+
[TracksShip](https://trackship.info/) is a premium shipment tracking API flatform that fully integrates with WooCommerce with the Advanced Shipment Tracking. TrackShip automates the order management workflows, reduces customer inquiries, reduces time spent on customer service, and improves the post-purchase experience and satisfaction of your customers.
|
45 |
+
|
46 |
+
You must have account [TracksShip](https://trackship.info/) and connect your store in order to activate these advanced features:
|
47 |
+
|
48 |
+
* Automatically track your shipments with 100+ shipping providers.
|
49 |
+
* Display Shipment Status and latest shipment status, update date and est. delivery date on WooCommerce orders admin.
|
50 |
+
* Option to manually get shipment tracking updates for orders.
|
51 |
+
* Automatically change order status to Delivered once the shipment is delivered to your customers.
|
52 |
+
* Option to filter orders with invalid tracking numbers or by shipment status event in orders admin
|
53 |
+
* Send personalized emails to notify the customer when their shipments are In Transit, Out For Delivery, Delivered or have an exception.
|
54 |
+
* Direct customers to a Tracking page on your store.
|
55 |
|
56 |
== Localization ==
|
57 |
|
76 |
* [WooCommerce PDF Invoices & Packing Slips plugin](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips).
|
77 |
|
78 |
|
79 |
+
https://www.youtube.com/watch?v=Mw7laecPtyw
|
80 |
|
81 |
== Frequently Asked Questions ==
|
82 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 2.4 =
|
122 |
+
* Fixed warnings in tracking page
|
123 |
+
* Fixed error from customizer if WooCommerce uninstalled
|
124 |
+
* Fixed date format issue in Bulk Upload
|
125 |
+
* Addes Sync Providers List functionality for all users
|
126 |
+
* Added Hermes World Shipping provider
|
127 |
+
* Added option for "mark as shipped" will be selected by default when adding tracking info to orders
|
128 |
+
* Added Shipment Status filter in order list panel
|
129 |
+
* Updated Delivered orderemail customizer layout and Google analytics tracking
|
130 |
+
* Updated tracking page design
|
131 |
+
|
132 |
+
= 2.3.9 =
|
133 |
+
* Added "DHL Freight" provider
|
134 |
+
* Added functionality when check connection store status if api key is not available in plugin than add it
|
135 |
+
|
136 |
= 2.3.8 =
|
137 |
* Fixed - Trackship connection issue when trackship setting saved
|
138 |
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,14 +4,14 @@
|
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI:
|
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: 2.
|
8 |
* Author: zorem
|
9 |
* Author URI:
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
* Domain Path: /lang/
|
14 |
-
* WC tested up to: 3.
|
15 |
*/
|
16 |
|
17 |
|
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
-
public $version = '2.
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
@@ -51,7 +51,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
51 |
$this->table = $wpdb->prefix."woo_shippment_provider";
|
52 |
}
|
53 |
|
54 |
-
|
55 |
|
56 |
if ( $this->is_wc_active() ) {
|
57 |
// Include required files.
|
@@ -68,6 +68,8 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
68 |
|
69 |
//plugin install class init
|
70 |
$this->install->init();
|
|
|
|
|
71 |
}
|
72 |
add_action( 'admin_footer', array( $this, 'uninstall_notice') );
|
73 |
//register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
|
@@ -324,9 +326,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
324 |
public function on_plugins_loaded() {
|
325 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wcast-customizer.php';
|
326 |
|
327 |
-
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
|
328 |
-
|
329 |
-
//require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-page-customizer.php';
|
330 |
|
331 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
|
332 |
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI:
|
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: 2.4
|
8 |
* Author: zorem
|
9 |
* Author URI:
|
10 |
* License: GPL-2.0+
|
11 |
* License URI:
|
12 |
* Text Domain: woo-advanced-shipment-tracking
|
13 |
* Domain Path: /lang/
|
14 |
+
* WC tested up to: 3.7
|
15 |
*/
|
16 |
|
17 |
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
+
public $version = '2.4';
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
51 |
$this->table = $wpdb->prefix."woo_shippment_provider";
|
52 |
}
|
53 |
|
54 |
+
|
55 |
|
56 |
if ( $this->is_wc_active() ) {
|
57 |
// Include required files.
|
68 |
|
69 |
//plugin install class init
|
70 |
$this->install->init();
|
71 |
+
|
72 |
+
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
73 |
}
|
74 |
add_action( 'admin_footer', array( $this, 'uninstall_notice') );
|
75 |
//register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
|
326 |
public function on_plugins_loaded() {
|
327 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wcast-customizer.php';
|
328 |
|
329 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
|
|
|
|
|
330 |
|
331 |
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
|
332 |
|