Advanced Shipment Tracking for WooCommerce - Version 2.4.2

Version Description

  • Fixed issue in tracking page for unknown status
  • Added PostNL International 3S,GLS Europe and Yun Express Tracking provider
  • In tracking url added two more parameter - %country_code% and %postal_code%
  • Updated code for add tracking item programatically
  • Updated tracking page endpoint
  • Removed Tracking URL validation for add/edit custom shiping provider and if not added tracking url than not display track button
Download this release

Release Info

Developer zorem
Plugin Icon 128x128 Advanced Shipment Tracking for WooCommerce
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.3.8 to 2.4.2

Files changed (27) hide show
  1. assets/css/admin.css +23 -0
  2. assets/css/icons/invalid-user-key-v4.png +0 -0
  3. assets/js/customizer-scripts.js +11 -0
  4. assets/js/shipping_row.js +14 -5
  5. assets/shipment-provider-img/gls-europe.png +0 -0
  6. assets/shipment-provider-img/gls-italy.png +0 -0
  7. assets/shipment-provider-img/{hermes.png → hermes-germany.png} +0 -0
  8. assets/shipment-provider-img/hermes-world.png +0 -0
  9. assets/shipment-provider-img/malaysia-post.png +0 -0
  10. assets/shipment-provider-img/postnl-international-3s.png +0 -0
  11. assets/shipment-provider-img/yun-express-tracking.png +0 -0
  12. includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php +14 -2
  13. includes/class-wc-advanced-shipment-tracking-admin.php +161 -65
  14. includes/class-wc-advanced-shipment-tracking-api-call.php +15 -1
  15. includes/class-wc-advanced-shipment-tracking-front.php +81 -89
  16. includes/class-wc-advanced-shipment-tracking-install.php +133 -6
  17. includes/class-wc-advanced-shipment-tracking.php +123 -42
  18. includes/customizer/class-wc-availableforpickup-email-customizer.php +1 -1
  19. includes/customizer/class-wc-email-customizer.php +48 -28
  20. includes/emails/class-shipment-delivered-email.php +2 -1
  21. includes/views/admin_options_bulk_upload.php +1 -1
  22. includes/views/admin_options_settings (Eran Shor's conflicted copy 2019-08-07).php +0 -34
  23. includes/views/admin_options_shipping_provider.php +2 -4
  24. readme.txt +47 -7
  25. templates/emails/tracking-info.php +6 -4
  26. templates/myaccount/view-order.php +1 -1
  27. woocommerce-advanced-shipment-tracking.php +10 -8
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/js/shipping_row.js CHANGED
@@ -538,14 +538,14 @@ jQuery(document).on("click", ".close_synch_popup", function(){
538
  error = true;
539
  } else{
540
  hideerror(thumb_url);
541
- }*/
542
 
543
  if( tracking_url.val() === '' ){
544
  showerror(tracking_url);
545
  error = true;
546
  } else{
547
  hideerror(tracking_url);
548
- }
549
 
550
 
551
  if(error == true){
@@ -672,12 +672,12 @@ jQuery(document).on("submit", "#edit_provider_form", function(){
672
  hideerror(shipping_country);
673
  }
674
 
675
- if( tracking_url.val() === '' ){
676
  showerror(tracking_url);
677
  error = true;
678
  } else{
679
  hideerror(tracking_url);
680
- }
681
 
682
 
683
  if(error == true){
@@ -895,4 +895,13 @@ function showerror(element){
895
  }
896
  function hideerror(element){
897
  element.css("border","1px solid #ddd");
898
- }
 
 
 
 
 
 
 
 
 
538
  error = true;
539
  } else{
540
  hideerror(thumb_url);
541
+ }
542
 
543
  if( tracking_url.val() === '' ){
544
  showerror(tracking_url);
545
  error = true;
546
  } else{
547
  hideerror(tracking_url);
548
+ }*/
549
 
550
 
551
  if(error == true){
672
  hideerror(shipping_country);
673
  }
674
 
675
+ /*if( tracking_url.val() === '' ){
676
  showerror(tracking_url);
677
  error = true;
678
  } else{
679
  hideerror(tracking_url);
680
+ }*/
681
 
682
 
683
  if(error == true){
895
  }
896
  function hideerror(element){
897
  element.css("border","1px solid #ddd");
898
+ }
899
+ jQuery(document).on("change", "#wc_ast_status_shipped", function(){
900
+ if(jQuery(this).prop("checked") == true){
901
+ jQuery("[for=show_in_completed] .multiple_label").text('Shipped');
902
+ jQuery("label .shipped_label").text('shipped');
903
+ } else{
904
+ jQuery("[for=show_in_completed] .multiple_label").text('Completed');
905
+ jQuery("label .shipped_label").text('completed');
906
+ }
907
+ });
assets/shipment-provider-img/gls-europe.png ADDED
Binary file
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
assets/shipment-provider-img/malaysia-post.png ADDED
Binary file
assets/shipment-provider-img/postnl-international-3s.png ADDED
Binary file
assets/shipment-provider-img/yun-express-tracking.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
  );
@@ -182,7 +191,10 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
182
  update_post_meta( $order_id, "shipment_status", $shipment_status);
183
  }
184
  $st->check_tracking_delivered( $order_id );
185
- exit;
 
 
 
186
  }
187
 
188
  /**
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
  );
191
  update_post_meta( $order_id, "shipment_status", $shipment_status);
192
  }
193
  $st->check_tracking_delivered( $order_id );
194
+ $data = array(
195
+ 'status' => 'success'
196
+ );
197
+ return rest_ensure_response( $data );
198
  }
199
 
200
  /**
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
- $est_delivery_date = $shipment_status[$key]['est_delivery_date'];
 
 
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>
@@ -1054,6 +1056,18 @@ class WC_Advanced_Shipment_Tracking_Admin {
1054
  } else{
1055
  $show_invoice_field = false;
1056
  }
 
 
 
 
 
 
 
 
 
 
 
 
1057
  $form_data = array(
1058
  'wc_ast_status_shipped' => array(
1059
  'type' => 'checkbox',
@@ -1061,6 +1075,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(
@@ -1069,7 +1090,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1069
  "show_in_refunded" =>__( 'Refunded', 'woo-advanced-shipment-tracking' ),
1070
  "show_in_processing" =>__( 'Processing', 'woo-advanced-shipment-tracking' ),
1071
  "show_in_failed" =>__( 'Failed', 'woo-advanced-shipment-tracking' ),
1072
- "show_in_completed" =>__( 'Completed', 'woo-advanced-shipment-tracking' ),
1073
  ),
1074
  'show' => true,
1075
  'class' => '',
@@ -1277,7 +1298,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1277
  $date_shipped = date("d-m-Y");
1278
  }
1279
  $replace_tracking_info = $_POST['replace_tracking_info'];
1280
- // echo '<pre>';print_r($_POST['trackings']);echo '</pre>';
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 +1325,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 +1480,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 +1523,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 +1884,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
1898
  }
1899
 
1900
  public function sync_providers_fun(){
1901
- global $wpdb;
1902
- $wc_ast_api_key = get_option('wc_ast_api_key');
1903
- $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1904
- $arg = array(
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" );
@@ -1952,6 +1933,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1952
  }
1953
  } else{
1954
  $img_url = $provider['img_url'];
 
1955
  $img_slug = sanitize_title($provider_name);
1956
  $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1957
 
@@ -2050,4 +2032,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>
1056
  } else{
1057
  $show_invoice_field = false;
1058
  }
1059
+
1060
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
1061
+ if($wc_ast_status_shipped == 1){
1062
+ $completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
1063
+ $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>" checkbox state', 'woo-advanced-shipment-tracking' );
1064
+ $mark_as_shipped_tooltip = __( "This means that the 'mark as <span class='shipped_label'>shipped</span>' will be selected by default when adding tracking info to orders.", 'woo-advanced-shipment-tracking' );
1065
+ } else{
1066
+ $completed_order_label = __( 'Completed', 'woo-advanced-shipment-tracking' );
1067
+ $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">completed</span>" checkbox state', 'woo-advanced-shipment-tracking' );
1068
+ $mark_as_shipped_tooltip = __( "This means that the 'mark as <span class='shipped_label'>completed</span>' will be selected by default when adding tracking info to orders.", 'woo-advanced-shipment-tracking' );
1069
+ }
1070
+
1071
  $form_data = array(
1072
  'wc_ast_status_shipped' => array(
1073
  'type' => 'checkbox',
1075
  'show' => true,
1076
  'class' => '',
1077
  ),
1078
+ 'wc_ast_default_mark_shipped' => array(
1079
+ 'type' => 'checkbox',
1080
+ 'title' => $mark_as_shipped_label,
1081
+ 'tooltip' => $mark_as_shipped_tooltip,
1082
+ 'show' => true,
1083
+ 'class' => '',
1084
+ ),
1085
  'wc_ast_unclude_tracking_info' => array(
1086
  'type' => 'multiple_checkbox',
1087
  'title' => __( 'On which customer order status email to include tracking info?', 'woo-advanced-shipment-tracking' ),'options' => array(
1090
  "show_in_refunded" =>__( 'Refunded', 'woo-advanced-shipment-tracking' ),
1091
  "show_in_processing" =>__( 'Processing', 'woo-advanced-shipment-tracking' ),
1092
  "show_in_failed" =>__( 'Failed', 'woo-advanced-shipment-tracking' ),
1093
+ "show_in_completed" =>__( $completed_order_label, 'woo-advanced-shipment-tracking' ),
1094
  ),
1095
  'show' => true,
1096
  'class' => '',
1298
  $date_shipped = date("d-m-Y");
1299
  }
1300
  $replace_tracking_info = $_POST['replace_tracking_info'];
1301
+
1302
  global $wpdb;
1303
  $woo_shippment_table_name = $this->table;
1304
  $shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
1325
  if ( count( $tracking_items ) > 0 ) {
1326
  foreach ( $tracking_items as $key => $item ) {
1327
  $tracking_number = $item['tracking_number'];
1328
+ //echo '<pre>';print_r($tracking_number);echo '</pre>';exit;
1329
  if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
1330
 
1331
  } else{
1480
  case "carrier_unsupported":
1481
  $status = __( 'Carrier unsupported', 'woo-advanced-shipment-tracking' );
1482
  break;
1483
+ case "invalid_user_key":
1484
+ $status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
1485
+ break;
1486
+
1487
  }
1488
  return $status;
1489
  }
1523
  case "INVALID_TRACKING_NUM":
1524
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1525
  break;
1526
+ case "invalid_user_key":
1527
+ $html = '<span class="icon-'.$status.'">';
1528
+ break;
1529
  default:
1530
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1531
  break;
1532
 
1533
  }
1534
  return $html;
1535
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1536
 
1537
  /*
1538
  * retry trackship api call
1884
  }
1885
 
1886
  public function sync_providers_fun(){
1887
+ global $wpdb;
1888
+
1889
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1890
+ $resp = wp_remote_get( $url );
 
 
 
 
 
1891
  $providers = json_decode($resp['body'],true);
1892
 
1893
  $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
1933
  }
1934
  } else{
1935
  $img_url = $provider['img_url'];
1936
+
1937
  $img_slug = sanitize_title($provider_name);
1938
  $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1939
 
2032
  <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>
2033
  <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>
2034
  <?php }
2035
+ /**
2036
+ * Add bulk filter for Shipment status in orders list
2037
+ *
2038
+ * @since 2.4
2039
+ */
2040
+ public function filter_orders_by_shipment_status(){
2041
+ global $typenow;
2042
+
2043
+ if ( 'shop_order' === $typenow ) {
2044
+
2045
+ $count = $this->get_order_count();
2046
+
2047
+ $terms = array(
2048
+ 'unknown' => (object) array( 'count' => $count['unknown'], 'term' => __( 'Unknown', 'woo-advanced-shipment-tracking' ) ),
2049
+ 'pre_transit' => (object) array( 'count' => $count['pre_transit'],'term' => __( 'Pre Transit', 'woo-advanced-shipment-tracking' ) ),
2050
+ 'in_transit' => (object) array( 'count' => $count['in_transit'],'term' => __( 'In Transit', 'woo-advanced-shipment-tracking' ) ),
2051
+ 'available_for_pickup' => (object) array( 'count' => $count['available_for_pickup'],'term' => __( 'Available for Pickup', 'woo-advanced-shipment-tracking' ) ),
2052
+ 'out_for_delivery' => (object) array( 'count' => $count['out_for_delivery'],'term' => __( 'Out for Delivery', 'woo-advanced-shipment-tracking' ) ),
2053
+ 'delivered' => (object) array( 'count' => $count['delivered'],'term' => __( 'Delivered', 'woo-advanced-shipment-tracking' ) ),
2054
+ 'failed_attempt' => (object) array( 'count' => $count['failed_attempt'],'term' => __( 'Failed Attempt', 'woo-advanced-shipment-tracking' ) ),
2055
+ 'cancelled' => (object) array( 'count' => $count['cancelled'],'term' => __( 'Cancelled', 'woo-advanced-shipment-tracking' ) ),
2056
+ 'carrier_unsupported' => (object) array( 'count' => $count['carrier_unsupported'],'term' => __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' ) ),
2057
+ 'return_to_sender' => (object) array( 'count' => $count['return_to_sender'],'term' => __( 'Return To Sender', 'woo-advanced-shipment-tracking' ) ),
2058
+ 'INVALID_TRACKING_NUM' => (object) array( 'count' => $count['invalid_tracking_number'],'term' => __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' ) ),
2059
+ );
2060
+
2061
+ ?>
2062
+ <select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
2063
+ <option value=""><?php _e( 'Filter by shipment status', 'woo-advanced-shipment-tracking' ); ?></option>
2064
+ <?php foreach ( $terms as $value => $term ) : ?>
2065
+ <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 ) : '' ); ?>>
2066
+ <?php printf( '%1$s (%2$s)', esc_html( $term->term ), esc_html( $term->count ) ); ?>
2067
+ </option>
2068
+ <?php endforeach; ?>
2069
+ </select>
2070
+ <?php
2071
+ }
2072
+ }
2073
+
2074
+ /**
2075
+ * Get the order count for orders by shipment status
2076
+ * @since 2.4
2077
+ */
2078
+ private function get_order_count() {
2079
+
2080
+ $query_args = array(
2081
+ 'fields' => 'ids',
2082
+ 'post_type' => 'shop_order',
2083
+ 'post_status' => isset( $_GET['post_status'] ) ? $_GET['post_status'] : 'any',
2084
+ 'meta_query' => array(
2085
+ array(
2086
+ 'key' => 'shipment_status',
2087
+ 'value' => '',
2088
+ 'compare' => 'LIKE',
2089
+ )
2090
+ ),
2091
+ 'nopaging' => true,
2092
+ );
2093
+
2094
+ $order_query = new WP_Query( $query_args );
2095
+
2096
+ $query_args['meta_query'][0]['value'] = 'delivered';
2097
+ $delivered_query = new WP_Query( $query_args );
2098
+
2099
+ $query_args['meta_query'][0]['value'] = 'unknown';
2100
+ $unknown_query = new WP_Query( $query_args );
2101
+
2102
+ $query_args['meta_query'][0]['value'] = 'pre_transit';
2103
+ $pre_transit_query = new WP_Query( $query_args );
2104
+
2105
+ $query_args['meta_query'][0]['value'] = 'in_transit';
2106
+ $in_transit_query = new WP_Query( $query_args );
2107
+
2108
+ $query_args['meta_query'][0]['value'] = 'available_for_pickup';
2109
+ $available_for_pickup_query = new WP_Query( $query_args );
2110
+
2111
+ $query_args['meta_query'][0]['value'] = 'out_for_delivery';
2112
+ $out_for_delivery_query = new WP_Query( $query_args );
2113
+
2114
+ $query_args['meta_query'][0]['value'] = 'failed_attempt';
2115
+ $failed_attempt_query = new WP_Query( $query_args );
2116
+
2117
+ $query_args['meta_query'][0]['value'] = 'cancelled';
2118
+ $cancelled_query = new WP_Query( $query_args );
2119
+
2120
+ $query_args['meta_query'][0]['value'] = 'carrier_unsupported';
2121
+ $carrier_unsupported_query = new WP_Query( $query_args );
2122
+
2123
+ $query_args['meta_query'][0]['value'] = 'return_to_sender';
2124
+ $return_to_sender_query = new WP_Query( $query_args );
2125
+
2126
+ $query_args['meta_query'][0]['value'] = 'INVALID_TRACKING_NUM';
2127
+ $invalid_tracking_number_query = new WP_Query( $query_args );
2128
+
2129
+ 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);
2130
+ }
2131
+ /**
2132
+ * Process bulk filter action for shipment status orders
2133
+ *
2134
+ * @since 3.0.0
2135
+ * @param array $vars query vars without filtering
2136
+ * @return array $vars query vars with (maybe) filtering
2137
+ */
2138
+ public function filter_orders_by_shipment_status_query( $vars ){
2139
+ global $typenow;
2140
+
2141
+ if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] )) {
2142
+ $vars['meta_key'] = 'shipment_status';
2143
+ $vars['meta_value'] = $_GET['_shop_order_shipment_status'];
2144
+ $vars['meta_compare'] = 'LIKE';
2145
+ }
2146
+
2147
+ return $vars;
2148
+ }
2149
  }
includes/class-wc-advanced-shipment-tracking-api-call.php CHANGED
@@ -105,9 +105,21 @@ 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 = get_site_url();
109
  $order_id = $order->get_id();
110
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  $url = 'https://trackship.info/wp-json/tracking/create';
112
 
113
  $args['body'] = array(
@@ -116,6 +128,8 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
116
  'domain' => $domain,
117
  'tracking_number' => $tracking_number,
118
  'tracking_provider' => $tracking_provider,
 
 
119
  );
120
 
121
  $args['headers'] = array(
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
+ if($order->get_shipping_country() != null){
112
+ $shipping_country = $order->get_shipping_country();
113
+ } else{
114
+ $shipping_country = $order->get_billing_country();
115
+ }
116
+
117
+ if($order->get_shipping_postcode() != null){
118
+ $shipping_postal_code = $order->get_shipping_postcode();
119
+ } else{
120
+ $shipping_postal_code = $order->get_billing_postcode();
121
+ }
122
+
123
  $url = 'https://trackship.info/wp-json/tracking/create';
124
 
125
  $args['body'] = array(
128
  'domain' => $domain,
129
  'tracking_number' => $tracking_number,
130
  'tracking_provider' => $tracking_provider,
131
+ 'postal_code' => $shipping_postal_code,
132
+ 'destination_country' => $shipping_country,
133
  );
134
 
135
  $args['headers'] = array(
includes/class-wc-advanced-shipment-tracking-front.php CHANGED
@@ -57,31 +57,7 @@ class WC_Advanced_Shipment_Tracking_Front {
57
  $border_color = get_option('wc_ast_select_border_color');
58
  ?>
59
  <style>
60
- <?php /*if($success_color){ ?>
61
- .bg-success{
62
- background-color:<?php echo $success_color; ?> !important;
63
- }
64
- .tracker-progress-bar-with-dots .success .dot{
65
- border-color: <?php echo $success_color; ?>;
66
- }
67
- .text-success{
68
- color: <?php echo $success_color; ?> !important;
69
- }
70
- .progress-bar.bg-success:before{
71
- background-color: <?php echo $success_color; ?>;
72
- }
73
- <?php } ?>
74
- <?php if($warning_color){ ?>
75
- .bg-warning{
76
- background-color:<?php echo $warning_color; ?> !important;
77
- }
78
- .tracker-progress-bar-with-dots .warning .dot{
79
- border-color: <?php echo $warning_color; ?>;
80
- }
81
- .text-warning{
82
- color: <?php echo $warning_color; ?> !important;
83
- }
84
- <?php } */?>
85
  <?php if($primary_color){ ?>
86
  .bg-secondary{
87
  background-color:<?php echo $primary_color; ?> !important;
@@ -119,17 +95,15 @@ class WC_Advanced_Shipment_Tracking_Front {
119
  if($order_key != $_GET['order_key']){
120
  return;
121
  }
122
- //$order_key = $_GET['key'];
123
  if(!get_post_status( $order_id )){
124
  return;
125
  }
126
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
127
- $tracking_items = get_post_meta( $order_id, '_wc_shipment_tracking_items', true );
128
- //$get_order_key = get_post_meta( $order_id, 'order_key', true );
129
  } else {
130
  $order = new WC_Order( $order_id );
131
- $tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
132
- //$get_order_key = $order->order_key;
133
  }
134
  if(!$tracking_items){
135
  unset($order_id);
@@ -226,23 +200,30 @@ 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';
 
 
 
 
 
232
  $args['body'] = array(
233
- 'tracking_number' => $tracking_number
 
 
 
234
  );
235
  $response = wp_remote_post( $url, $args );
236
  $data = $response['body'];
237
  $decoded_data = json_decode($data);
238
- //echo '<pre>';print_r($decoded_data);echo '</pre>';
239
  if(!empty($decoded_data)){
240
  $tracker = $decoded_data[0];
241
  }
242
 
243
- $tracking_detail_org = '';
244
-
245
-
246
 
247
  if(isset($tracker->tracking_detail) && $tracker->tracking_detail != 'null'){
248
  $tracking_detail = array_reverse(json_decode($tracker->tracking_detail));
@@ -254,12 +235,14 @@ class WC_Advanced_Shipment_Tracking_Front {
254
  $trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
255
  }
256
 
257
- $unixTimestamp = strtotime($tracker->est_delivery_date);
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 +263,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 _e( 'Tracking: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $tracker->tracking_code; ?></span>
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">
@@ -301,11 +284,11 @@ class WC_Advanced_Shipment_Tracking_Front {
301
  <div class="status-section desktop-section">
302
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
303
  <div class="progress">
304
- <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>" style="<?php /*if($tracker->ep_status == "in_transit") { echo 'width:33%;'; } elseif($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'width:66%';} elseif($tracker->ep_status == "delivered") { echo 'width:100%'; }*/ ?>"></div>
305
  </div>
306
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
307
- <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
308
- <span class="state-label <?php if($tracker->ep_status =="pre_transit"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
309
  <?php
310
  if($tracker->ep_status == "unknown"){
311
  echo apply_filters("trackship_status_filter",'unknown');
@@ -315,13 +298,13 @@ class WC_Advanced_Shipment_Tracking_Front {
315
  ?>
316
  </span>
317
 
318
- <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
319
- <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
320
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
321
  </span>
322
 
323
- <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
324
- <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
325
  <?php
326
  if($tracker->ep_status == "return_to_sender"){
327
  echo apply_filters("trackship_status_filter",'return_to_sender');
@@ -333,8 +316,8 @@ class WC_Advanced_Shipment_Tracking_Front {
333
  ?>
334
  </span>
335
 
336
- <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
337
- <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
338
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
339
  </span>
340
  </div>
@@ -344,13 +327,13 @@ class WC_Advanced_Shipment_Tracking_Front {
344
  <div class="status-section mobile-section">
345
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
346
  <div class="progress">
347
- <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>" style="<?php /*if($tracker->ep_status == "in_transit") { echo 'height:33%;'; } elseif($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'height:66%';} elseif($tracker->ep_status == "delivered") { echo 'height:100%'; }*/ ?>"></div>
348
  </div>
349
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
350
 
351
  <div class="dot-div">
352
- <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
353
- <span class="state-label <?php if($tracker->ep_status =="pre_transit"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
354
  <?php
355
  if($tracker->ep_status == "unknown"){
356
  echo apply_filters("trackship_status_filter",'unknown');
@@ -362,15 +345,15 @@ class WC_Advanced_Shipment_Tracking_Front {
362
  </div>
363
 
364
  <div class="dot-div">
365
- <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
366
- <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
367
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
368
  </span>
369
  </div>
370
 
371
  <div class="dot-div">
372
- <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
373
- <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo ' past-state'; } ?>">
374
  <?php
375
  if($tracker->ep_status == "return_to_sender"){
376
  echo apply_filters("trackship_status_filter",'return_to_sender');
@@ -384,8 +367,8 @@ class WC_Advanced_Shipment_Tracking_Front {
384
  </div>
385
 
386
  <div class="dot-div">
387
- <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
388
- <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
389
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
390
  </span>
391
  </div>
@@ -514,7 +497,7 @@ class WC_Advanced_Shipment_Tracking_Front {
514
  wp_reset_postdata();
515
  }
516
  }
517
- //echo $order_email;exit;
518
  if(!get_post_status( $order_id )){
519
  echo '';
520
  exit;
@@ -545,15 +528,24 @@ class WC_Advanced_Shipment_Tracking_Front {
545
  foreach($tracking_items as $item){
546
  $tracking_number = $item['tracking_number'];
547
  $trackship_url = 'https://trackship.info';
548
- $url = $trackship_url.'/wp-json/wc/v1/get_tracking_info_by_number';
 
 
 
 
 
549
  $args['body'] = array(
550
- 'tracking_number' => $tracking_number
 
 
 
551
  );
 
552
  $response = wp_remote_post( $url, $args );
553
 
554
  $data = $response['body'];
555
  $decoded_data = json_decode($data);
556
- //echo '<pre>';print_r($decoded_data);echo '</pre>';exit;
557
  $tracker = $decoded_data[0];
558
  if(!$tracker){
559
  header("Status: 404 Not Found");
@@ -584,7 +576,7 @@ class WC_Advanced_Shipment_Tracking_Front {
584
  $unixTimestamp = strtotime($decoded_data[0]->est_delivery_date);
585
  //Get the day of the week using PHP's date function.
586
  $day = date("l", $unixTimestamp);
587
- if($tracking_detail_org){
588
  ?>
589
  <div class="tracking-detail col">
590
  <?php if($total_trackings > 1 ){ ?>
@@ -594,7 +586,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 _e( 'Tracking: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $tracker->tracking_code; ?></span>
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">
@@ -615,11 +607,11 @@ class WC_Advanced_Shipment_Tracking_Front {
615
  <div class="status-section desktop-section">
616
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
617
  <div class="progress">
618
- <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>" style="<?php /*if($tracker->ep_status == "in_transit") { echo 'width:33%;'; } elseif($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'width:66%';} elseif($tracker->ep_status == "delivered") { echo 'width:100%'; }*/ ?>"></div>
619
  </div>
620
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
621
- <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
622
- <span class="state-label <?php if($tracker->ep_status =="pre_transit"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
623
  <?php
624
  if($tracker->ep_status == "unknown"){
625
  echo apply_filters("trackship_status_filter",'unknown');
@@ -629,13 +621,13 @@ class WC_Advanced_Shipment_Tracking_Front {
629
  ?>
630
  </span>
631
 
632
- <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
633
- <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
634
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
635
  </span>
636
 
637
- <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
638
- <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
639
  <?php
640
  if($tracker->ep_status == "return_to_sender"){
641
  echo apply_filters("trackship_status_filter",'return_to_sender');
@@ -647,8 +639,8 @@ class WC_Advanced_Shipment_Tracking_Front {
647
  ?>
648
  </span>
649
 
650
- <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
651
- <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
652
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
653
  </span>
654
  </div>
@@ -658,13 +650,13 @@ class WC_Advanced_Shipment_Tracking_Front {
658
  <div class="status-section mobile-section">
659
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
660
  <div class="progress">
661
- <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>" style="<?php /*if($tracker->ep_status == "in_transit") { echo 'height:33%;'; } elseif($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'height:66%';} elseif($tracker->ep_status == "delivered") { echo 'height:100%'; }*/ ?>"></div>
662
  </div>
663
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
664
 
665
  <div class="dot-div">
666
- <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
667
- <span class="state-label <?php if($tracker->ep_status =="pre_transit"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
668
  <?php
669
  if($tracker->ep_status == "unknown"){
670
  echo apply_filters("trackship_status_filter",'unknown');
@@ -676,15 +668,15 @@ class WC_Advanced_Shipment_Tracking_Front {
676
  </div>
677
 
678
  <div class="dot-div">
679
- <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
680
- <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
681
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
682
  </span>
683
  </div>
684
 
685
  <div class="dot-div">
686
- <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
687
- <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo ' past-state'; } ?>">
688
  <?php
689
  if($tracker->ep_status == "return_to_sender"){
690
  echo apply_filters("trackship_status_filter",'return_to_sender');
@@ -698,8 +690,8 @@ class WC_Advanced_Shipment_Tracking_Front {
698
  </div>
699
 
700
  <div class="dot-div">
701
- <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
702
- <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
703
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
704
  </span>
705
  </div>
@@ -710,12 +702,12 @@ class WC_Advanced_Shipment_Tracking_Front {
710
 
711
  <div class="shipment_progress_div">
712
  <div class="shipment_progress_heading_div">
713
- <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){?>
714
  <h4 class="tracking-number h4-heading" style=""><?php _e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
715
  <?php } ?>
716
  </div>
717
  <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){
718
- //echo '<pre>';print_r($trackind_detail_by_status_rev);echo '</pre>';
719
  ?>
720
  <table class="tracking-table">
721
  <tbody>
@@ -737,7 +729,7 @@ class WC_Advanced_Shipment_Tracking_Front {
737
  <a class="hide_table_rows" href="javaScript:void(0);"><?php _e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
738
  <?php } } ?>
739
  </div>
740
- </div>
741
  <?php } else{ ?>
742
  <div class="tracking-detail col">
743
  <h1 class="shipment_status_heading text-secondary text-center"><?php _e( 'Tracking&nbsp;#&nbsp;'.$tracking_number, 'woo-advanced-shipment-tracking' ); ?></h1>
@@ -813,7 +805,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
- Tracking: <span class="tracking-number">#9405511899561468285343</span>
817
  <h1 class="shipment_status_heading text-success">Delivered</h1>
818
  </div>
819
  <div class="col-md col-md-6">
@@ -915,4 +907,4 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
915
  get_footer();
916
  exit;
917
  }
918
- }
57
  $border_color = get_option('wc_ast_select_border_color');
58
  ?>
59
  <style>
60
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  <?php if($primary_color){ ?>
62
  .bg-secondary{
63
  background-color:<?php echo $primary_color; ?> !important;
95
  if($order_key != $_GET['order_key']){
96
  return;
97
  }
98
+
99
  if(!get_post_status( $order_id )){
100
  return;
101
  }
102
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
103
+ $tracking_items = get_post_meta( $order_id, '_wc_shipment_tracking_items', true );
 
104
  } else {
105
  $order = new WC_Order( $order_id );
106
+ $tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
 
107
  }
108
  if(!$tracking_items){
109
  unset($order_id);
200
  $num = 1;
201
  $total_trackings = sizeof($tracking_items);
202
  foreach($tracking_items as $item){
203
+
204
  $tracking_number = $item['tracking_number'];
205
  $trackship_url = 'https://trackship.info';
206
+
207
+ /*** Update in 2.4.1
208
+ * Change URL
209
+ * Add User Key
210
+ ***/
211
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info';
212
  $args['body'] = array(
213
+ 'tracking_number' => $tracking_number,
214
+ 'order_id' => $order_id,
215
+ 'domain' => get_home_url(),
216
+ 'user_key' => $wc_ast_api_key,
217
  );
218
  $response = wp_remote_post( $url, $args );
219
  $data = $response['body'];
220
  $decoded_data = json_decode($data);
221
+
222
  if(!empty($decoded_data)){
223
  $tracker = $decoded_data[0];
224
  }
225
 
226
+ $tracking_detail_org = '';
 
 
227
 
228
  if(isset($tracker->tracking_detail) && $tracker->tracking_detail != 'null'){
229
  $tracking_detail = array_reverse(json_decode($tracker->tracking_detail));
235
  $trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
236
  }
237
 
 
 
 
 
 
238
 
239
+ if(!empty($decoded_data)){
240
+
241
+ if($tracker->est_delivery_date){
242
+ $unixTimestamp = strtotime($tracker->est_delivery_date);
243
+ $day = date("l", $unixTimestamp);
244
+ }
245
+
246
  if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
247
  if($tracker->ep_status == "return_to_sender" ){
248
  $state2_class = 'return_to_sender';
263
  <div class="tracking-header">
264
  <div class="col-md col-md-6">
265
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
266
+ <?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
267
  <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>
268
  </div>
269
  <div class="col-md col-md-6">
284
  <div class="status-section desktop-section">
285
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
286
  <div class="progress">
287
+ <div class="progress-bar"></div>
288
  </div>
289
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
290
+ <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
291
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
292
  <?php
293
  if($tracker->ep_status == "unknown"){
294
  echo apply_filters("trackship_status_filter",'unknown');
298
  ?>
299
  </span>
300
 
301
+ <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
302
+ <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
303
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
304
  </span>
305
 
306
+ <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
307
+ <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
308
  <?php
309
  if($tracker->ep_status == "return_to_sender"){
310
  echo apply_filters("trackship_status_filter",'return_to_sender');
316
  ?>
317
  </span>
318
 
319
+ <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
320
+ <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
321
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
322
  </span>
323
  </div>
327
  <div class="status-section mobile-section">
328
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
329
  <div class="progress">
330
+ <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>"></div>
331
  </div>
332
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
333
 
334
  <div class="dot-div">
335
+ <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
336
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
337
  <?php
338
  if($tracker->ep_status == "unknown"){
339
  echo apply_filters("trackship_status_filter",'unknown');
345
  </div>
346
 
347
  <div class="dot-div">
348
+ <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
349
+ <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
350
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
351
  </span>
352
  </div>
353
 
354
  <div class="dot-div">
355
+ <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
356
+ <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo ' past-state'; } ?>">
357
  <?php
358
  if($tracker->ep_status == "return_to_sender"){
359
  echo apply_filters("trackship_status_filter",'return_to_sender');
367
  </div>
368
 
369
  <div class="dot-div">
370
+ <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
371
+ <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
372
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
373
  </span>
374
  </div>
497
  wp_reset_postdata();
498
  }
499
  }
500
+
501
  if(!get_post_status( $order_id )){
502
  echo '';
503
  exit;
528
  foreach($tracking_items as $item){
529
  $tracking_number = $item['tracking_number'];
530
  $trackship_url = 'https://trackship.info';
531
+
532
+ /*** Update in 2.4.1
533
+ * Change URL
534
+ * Add User Key
535
+ ***/
536
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info';
537
  $args['body'] = array(
538
+ 'tracking_number' => $tracking_number,
539
+ 'order_id' => $order_id,
540
+ 'domain' => get_home_url(),
541
+ 'user_key' => $wc_ast_api_key,
542
  );
543
+
544
  $response = wp_remote_post( $url, $args );
545
 
546
  $data = $response['body'];
547
  $decoded_data = json_decode($data);
548
+
549
  $tracker = $decoded_data[0];
550
  if(!$tracker){
551
  header("Status: 404 Not Found");
576
  $unixTimestamp = strtotime($decoded_data[0]->est_delivery_date);
577
  //Get the day of the week using PHP's date function.
578
  $day = date("l", $unixTimestamp);
579
+ if($decoded_data){
580
  ?>
581
  <div class="tracking-detail col">
582
  <?php if($total_trackings > 1 ){ ?>
586
  <div class="tracking-header">
587
  <div class="col-md col-md-6">
588
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
589
+ <?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
590
  <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>
591
  </div>
592
  <div class="col-md col-md-6">
607
  <div class="status-section desktop-section">
608
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
609
  <div class="progress">
610
+ <div class="progress-bar"></div>
611
  </div>
612
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
613
+ <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
614
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
615
  <?php
616
  if($tracker->ep_status == "unknown"){
617
  echo apply_filters("trackship_status_filter",'unknown');
621
  ?>
622
  </span>
623
 
624
+ <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
625
+ <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
626
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
627
  </span>
628
 
629
+ <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
630
+ <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
631
  <?php
632
  if($tracker->ep_status == "return_to_sender"){
633
  echo apply_filters("trackship_status_filter",'return_to_sender');
639
  ?>
640
  </span>
641
 
642
+ <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
643
+ <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
644
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
645
  </span>
646
  </div>
650
  <div class="status-section mobile-section">
651
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
652
  <div class="progress">
653
+ <div class="progress-bar <?php if($tracker->ep_status == "delivered") { echo 'bg-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'bg-warning'; } else{ echo 'bg-secondary';} ?>"></div>
654
  </div>
655
  <div style="background-color: transparent;" class="<?php if($tracker->ep_status == "delivered") { echo 'success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure" || $tracker->ep_status == "unknown") { echo 'warning'; } else{ echo 'secondary';} ?>">
656
 
657
  <div class="dot-div">
658
+ <span class="dot state-0 <?php echo $state0_class?> <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo ' current-state'; } else{ echo 'past-state';} ?>"></span>
659
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
660
  <?php
661
  if($tracker->ep_status == "unknown"){
662
  echo apply_filters("trackship_status_filter",'unknown');
668
  </div>
669
 
670
  <div class="dot-div">
671
+ <span class="dot state-1 in_transit <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>"></span>
672
+ <span class="state-label state-1 <?php if($tracker->ep_status == "in_transit"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown"){ echo 'future-state'; } else{ echo 'past-state'; } ?>">
673
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
674
  </span>
675
  </div>
676
 
677
  <div class="dot-div">
678
+ <span class="dot state-2 <?php echo $state2_class; if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo ' current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo ' future-state'; } else{ echo ' past-state'; } ?>"></span>
679
+ <span class="state-label state-2 <?php if($tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "failure" || $tracker->ep_status == "return_to_sender"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit"){ echo 'future-state'; } else{ echo ' past-state'; } ?>">
680
  <?php
681
  if($tracker->ep_status == "return_to_sender"){
682
  echo apply_filters("trackship_status_filter",'return_to_sender');
690
  </div>
691
 
692
  <div class="dot-div">
693
+ <span class="dot state-3 delivered <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>"></span>
694
+ <span class="state-label state-3 <?php if($tracker->ep_status == "delivered"){ echo 'current-state'; } elseif($tracker->ep_status == "pre_transit" || $tracker->ep_status =="unknown" || $tracker->ep_status == "in_transit" || $tracker->ep_status == "out_for_delivery" || $tracker->ep_status == "available_for_pickup" || $tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure"){ echo 'future-state'; }?>">
695
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
696
  </span>
697
  </div>
702
 
703
  <div class="shipment_progress_div">
704
  <div class="shipment_progress_heading_div">
705
+ <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){?>
706
  <h4 class="tracking-number h4-heading" style=""><?php _e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
707
  <?php } ?>
708
  </div>
709
  <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){
710
+
711
  ?>
712
  <table class="tracking-table">
713
  <tbody>
729
  <a class="hide_table_rows" href="javaScript:void(0);"><?php _e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
730
  <?php } } ?>
731
  </div>
732
+ </div>
733
  <?php } else{ ?>
734
  <div class="tracking-detail col">
735
  <h1 class="shipment_status_heading text-secondary text-center"><?php _e( 'Tracking&nbsp;#&nbsp;'.$tracking_number, 'woo-advanced-shipment-tracking' ); ?></h1>
805
  <div class="tracking-header">
806
  <div class="col-md col-md-6">
807
  Order: <span class="tracking-number">#4542</span><br>
808
+ USPS: <span class="tracking-number">9405511899561468285343</span>
809
  <h1 class="shipment_status_heading text-success">Delivered</h1>
810
  </div>
811
  <div class="col-md col-md-6">
907
  get_footer();
908
  exit;
909
  }
910
+ }
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', '2.9');
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://tracking.hermesworld.com/?TrackID=%number%',
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,120 @@ 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
  */
@@ -1455,4 +1582,4 @@ class WC_Advanced_Shipment_Tracking_Install {
1455
  </div>
1456
  <?php
1457
  }
1458
- }
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
+ if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.2', '<') ){
1476
+ $this->update_shipping_providers();
1477
+ update_option( 'wc_advanced_shipment_tracking', '3.2');
1478
+ }
1479
  }
1480
  }
1481
+
1482
+ public function update_shipping_providers(){
1483
+ global $wpdb;
1484
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1485
+ $resp = wp_remote_get( $url );
1486
+ $providers = json_decode($resp['body'],true);
1487
+
1488
+ $providers_name = array();
1489
+
1490
+ $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
1491
+
1492
+ foreach ( $default_shippment_providers as $key => $val ){
1493
+ $shippment_providers[ $val->provider_name ] = $val;
1494
+ }
1495
+
1496
+ foreach ( $providers as $key => $val ){
1497
+ $providers_name[ $val['provider_name'] ] = $val;
1498
+ }
1499
+
1500
+ foreach($providers as $provider){
1501
+
1502
+ $provider_name = $provider['shipping_provider'];
1503
+ $provider_url = $provider['provider_url'];
1504
+ $shipping_country = $provider['shipping_country'];
1505
+ $ts_slug = $provider['shipping_provider_slug'];
1506
+
1507
+ if(isset($shippment_providers[$provider_name])){
1508
+ $db_provider_url = $shippment_providers[$provider_name]->provider_url;
1509
+ $db_shipping_country = $shippment_providers[$provider_name]->shipping_country;
1510
+ $db_ts_slug = $shippment_providers[$provider_name]->ts_slug;
1511
+ if(($db_provider_url != $provider_url) || ($db_shipping_country != $shipping_country) || ($db_ts_slug != $ts_slug)){
1512
+ $data_array = array(
1513
+ 'ts_slug' => $ts_slug,
1514
+ 'provider_url' => $provider_url,
1515
+ 'shipping_country' => $shipping_country,
1516
+ );
1517
+ $where_array = array(
1518
+ 'provider_name' => $provider_name,
1519
+ );
1520
+ $wpdb->update( $this->table, $data_array, $where_array);
1521
+ }
1522
+ } else{
1523
+ $img_url = $provider['img_url'];
1524
+ $img_slug = sanitize_title($provider_name);
1525
+ $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1526
+
1527
+ $ch = curl_init();
1528
+
1529
+ curl_setopt($ch, CURLOPT_HEADER, 0);
1530
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1531
+ curl_setopt($ch, CURLOPT_URL, $img_url);
1532
+
1533
+ $data = curl_exec($ch);
1534
+ curl_close($ch);
1535
+
1536
+ file_put_contents($img, $data);
1537
+
1538
+
1539
+ $data_array = array(
1540
+ 'shipping_country' => sanitize_text_field($shipping_country),
1541
+ 'provider_name' => sanitize_text_field($provider_name),
1542
+ 'ts_slug' => $ts_slug,
1543
+ 'provider_url' => sanitize_text_field($provider_url),
1544
+ 'display_in_order' => 0,
1545
+ 'shipping_default' => 1,
1546
+ );
1547
+ $result = $wpdb->insert( $this->table, $data_array );
1548
+ }
1549
+ }
1550
+ foreach($default_shippment_providers as $db_provider){
1551
+ if(!is_array($providers_name[$db_provider->provider_name])){
1552
+ $where = array(
1553
+ 'provider_name' => $db_provider->provider_name,
1554
+ 'shipping_default' => 1
1555
+ );
1556
+ $wpdb->delete( $this->table, $where );
1557
+ }
1558
+ }
1559
+ }
1560
  /*
1561
  * Display admin notice on plugin install or update
1562
  */
1582
  </div>
1583
  <?php
1584
  }
1585
+ }
includes/class-wc-advanced-shipment-tracking.php CHANGED
@@ -57,7 +57,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
57
  if ( ! empty( $results ) ) {
58
 
59
  foreach ( $results as $row ) {
60
- $shippment_providers[ $row->provider_name ] = apply_filters( 'shipping_provider_url_template', $row->provider_url, $row->provider_name );
 
 
 
 
61
  }
62
 
63
  $this->providers = $shippment_providers;
@@ -169,13 +173,14 @@ 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){
176
- $change_order_status_label = 'Change order to Shipped?';
177
  } else{
178
- $change_order_status_label = 'Change order to Completed?';
179
  }
180
  ?>
181
  <div id="" class="popupwrapper add_tracking_popup" style="display:none;">
@@ -215,8 +220,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
215
  ) );
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 +247,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($formatted);echo '</pre>';
246
  ?>
247
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
248
  <p class="tracking-content">
@@ -333,12 +338,18 @@ 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){
339
- $change_order_status_label = 'Change order to Shipped?';
340
  } else{
341
- $change_order_status_label = 'Change order to Completed?';
342
  }
343
 
344
 
@@ -406,8 +417,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
- 'value' => '',
 
411
  ) );
412
 
413
  echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
@@ -778,11 +790,10 @@ class WC_Advanced_Shipment_Tracking_Actions {
778
 
779
  $link_format = '';
780
 
781
- foreach ( $this->get_providers() as $provider => $format ) {
782
-
783
- if ( sanitize_title( $provider ) === $tracking_item['tracking_provider'] ) {
784
- $link_format = $format;
785
- $formatted['formatted_tracking_provider'] = $provider;
786
  break;
787
  }
788
 
@@ -790,25 +801,43 @@ class WC_Advanced_Shipment_Tracking_Actions {
790
  break;
791
  }
792
  }
793
-
794
- if ( $link_format ) {
795
- $tracking_page = get_option('wc_ast_trackship_page_id');
796
- $wc_ast_api_key = get_option('wc_ast_api_key');
797
- $use_tracking_page = get_option('wc_ast_use_tracking_page');
798
-
799
- if( $wc_ast_api_key && $use_tracking_page){
800
- $order_key = $order->get_order_key();
801
- //echo $order_key;exit;
802
- $formatted['formatted_tracking_link'] = get_permalink( $tracking_page ).'?order_id='.$order_id.'&order_key='.$order_key;
803
- } else {
804
  $searchVal = array("%number%", str_replace(' ', '', "%2 $ s") );
805
  $tracking_number = str_replace(' ', '', $tracking_item['tracking_number']);
806
  $replaceVal = array( $tracking_number, urlencode( $postcode ) );
807
- $link_format = str_replace($searchVal, $replaceVal, $link_format);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  $formatted['formatted_tracking_link'] = $link_format;
809
  }
810
- }
811
-
812
  }
813
 
814
  return $formatted;
@@ -856,18 +885,18 @@ class WC_Advanced_Shipment_Tracking_Actions {
856
  if($args['tracking_provider']){
857
  $tracking_item['tracking_provider'] = $args['tracking_provider'];
858
  }
859
- if($args['custom_tracking_provider']){
860
- $tracking_item['custom_tracking_provider'] = wc_clean( $args['custom_tracking_provider'] );
861
- }
862
- if($args['custom_tracking_link']){
863
- $tracking_item['custom_tracking_link'] = wc_clean( $args['custom_tracking_link'] );
864
- }
865
  if($args['tracking_number']){
866
  $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
867
  }
868
  if($args['date_shipped']){
869
- $tracking_item['date_shipped'] = wc_clean( strtotime( $args['date_shipped'] ) );
 
 
 
 
870
  }
 
871
  if($args['status_shipped']){
872
  $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
873
  }
@@ -876,11 +905,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
876
  $tracking_item['date_shipped'] = time();
877
  }
878
 
879
- if ( $tracking_item['custom_tracking_provider'] ) {
880
- $tracking_item['tracking_id'] = md5( "{$tracking_item['custom_tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
881
- } else {
882
- $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
883
- }
884
 
885
  $tracking_items = $this->get_tracking_items( $order_id );
886
  $tracking_items[] = $tracking_item;
@@ -893,6 +918,62 @@ class WC_Advanced_Shipment_Tracking_Actions {
893
  }
894
  return $tracking_item;
895
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
896
 
897
  /**
898
  * Saves the tracking items array to post_meta.
57
  if ( ! empty( $results ) ) {
58
 
59
  foreach ( $results as $row ) {
60
+ //$shippment_providers[ $row->ts_slug ] = apply_filters( 'shipping_provider_url_template', $row->provider_url, $row->ts_slug );
61
+ $shippment_providers[ $row->ts_slug ] = array(
62
+ 'provider_name'=> $row->provider_name,
63
+ 'provider_url' => $row->provider_url,
64
+ );
65
  }
66
 
67
  $this->providers = $shippment_providers;
173
 
174
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
175
 
176
+ $default_provider = get_option("wc_ast_default_provider" );
177
+ $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
178
 
179
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
180
  if($wc_ast_status_shipped == 1){
181
+ $change_order_status_label = __( 'Change order to Shipped?', 'woo-advanced-shipment-tracking' );
182
  } else{
183
+ $change_order_status_label = __( 'Change order to Completed?', 'woo-advanced-shipment-tracking' );
184
  }
185
  ?>
186
  <div id="" class="popupwrapper add_tracking_popup" style="display:none;">
220
  ) );
221
  ?>
222
  <p class="form-field change_order_to_shipped_field ">
223
+ <label for="change_order_to_shipped"><?php echo $change_order_status_label; ?></label>
224
+ <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'; }?>>
225
  </p>
226
  <p class="" style="text-align:left;">
227
  <input type="hidden" name="action" value="add_inline_tracking_number">
247
  */
248
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
249
  $formatted = $this->get_formatted_tracking_item( $order_id, $item );
250
+ //echo '<pre>';print_r($item);echo '</pre>';
251
  ?>
252
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
253
  <p class="tracking-content">
338
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
339
 
340
  $default_provider = get_option("wc_ast_default_provider" );
341
+ $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
342
+ $value = 1;
343
+ $cbvalue = '';
344
+ if($wc_ast_default_mark_shipped == 1){
345
+ $cbvalue = 1;
346
+ }
347
 
348
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
349
  if($wc_ast_status_shipped == 1){
350
+ $change_order_status_label = __( 'Change order to Shipped?', 'woo-advanced-shipment-tracking' );
351
  } else{
352
+ $change_order_status_label = __( 'Change order to Completed?', 'woo-advanced-shipment-tracking' );
353
  }
354
 
355
 
417
  woocommerce_wp_checkbox( array(
418
  'id' => 'change_order_to_shipped',
419
  'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
420
+ 'description' => '',
421
+ 'cbvalue' => $cbvalue,
422
+ 'value' => $value,
423
  ) );
424
 
425
  echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
790
 
791
  $link_format = '';
792
 
793
+ foreach ( $this->get_providers() as $provider => $format ) {
794
+ if ( $provider === $tracking_item['tracking_provider'] ) {
795
+ $link_format = $format['provider_url'];
796
+ $formatted['formatted_tracking_provider'] = $format['provider_name'];
 
797
  break;
798
  }
799
 
801
  break;
802
  }
803
  }
804
+
805
+ $tracking_page = get_option('wc_ast_trackship_page_id');
806
+ $wc_ast_api_key = get_option('wc_ast_api_key');
807
+ $use_tracking_page = get_option('wc_ast_use_tracking_page');
808
+
809
+ if( $wc_ast_api_key && $use_tracking_page){
810
+ $order_key = $order->get_order_key();
811
+ $formatted['formatted_tracking_link'] = get_permalink( $tracking_page ).'?order_id='.$order_id.'&order_key='.$order_key;
812
+ } else {
813
+ if ( $link_format ) {
 
814
  $searchVal = array("%number%", str_replace(' ', '', "%2 $ s") );
815
  $tracking_number = str_replace(' ', '', $tracking_item['tracking_number']);
816
  $replaceVal = array( $tracking_number, urlencode( $postcode ) );
817
+ $link_format = str_replace($searchVal, $replaceVal, $link_format);
818
+
819
+ if($order->get_shipping_country() != null){
820
+ $shipping_country = $order->get_shipping_country();
821
+ } else{
822
+ $shipping_country = $order->get_billing_country();
823
+ }
824
+
825
+ if($order->get_shipping_postcode() != null){
826
+ $shipping_postal_code = $order->get_shipping_postcode();
827
+ } else{
828
+ $shipping_postal_code = $order->get_billing_postcode();
829
+ }
830
+
831
+ $country_code = array("%country_code%", str_replace(' ', '', "%2 $ s") );
832
+ $link_format = str_replace($country_code, $shipping_country, $link_format);
833
+
834
+ $postal_code = array("%postal_code%", str_replace(' ', '', "%2 $ s") );
835
+ $link_format = str_replace($postal_code, $shipping_postal_code, $link_format);
836
+
837
+ //echo '<pre>';print_r($shipping_postal_code);echo '</pre>';
838
  $formatted['formatted_tracking_link'] = $link_format;
839
  }
840
+ }
 
841
  }
842
 
843
  return $formatted;
885
  if($args['tracking_provider']){
886
  $tracking_item['tracking_provider'] = $args['tracking_provider'];
887
  }
888
+
 
 
 
 
 
889
  if($args['tracking_number']){
890
  $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
891
  }
892
  if($args['date_shipped']){
893
+ $date = str_replace("/","-",$args['date_shipped']);
894
+ $date = date_create($date);
895
+ $date = date_format($date,"d-m-Y");
896
+
897
+ $tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
898
  }
899
+
900
  if($args['status_shipped']){
901
  $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
902
  }
905
  $tracking_item['date_shipped'] = time();
906
  }
907
 
908
+ $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
 
 
 
 
909
 
910
  $tracking_items = $this->get_tracking_items( $order_id );
911
  $tracking_items[] = $tracking_item;
918
  }
919
  return $tracking_item;
920
  }
921
+
922
+ /*
923
+ * Adds a tracking item to the post_meta array from external system programatticaly
924
+ *
925
+ * @param int $order_id Order ID
926
+ * @param array $tracking_items List of tracking item
927
+ *
928
+ * @return array Tracking item
929
+ */
930
+ public function insert_tracking_item( $order_id, $args ) {
931
+ $tracking_item = array();
932
+ $tracking_provider = $args['tracking_provider'];
933
+
934
+ global $wpdb;
935
+ $woo_shippment_table_name = wc_advanced_shipment_tracking()->table;
936
+ $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_provider."'" );
937
+
938
+ if($args['tracking_provider']){
939
+ $tracking_item['tracking_provider'] = $shippment_provider['0']->ts_slug;
940
+ }
941
+ if($args['tracking_number']){
942
+ $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
943
+ }
944
+ if($args['date_shipped']){
945
+ $date = str_replace("/","-",$args['date_shipped']);
946
+ $date = date_create($date);
947
+ $date = date_format($date,"d-m-Y");
948
+
949
+ $tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
950
+ }
951
+
952
+ if($args['status_shipped']){
953
+ $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
954
+ }
955
+
956
+ if ( 0 == (int) $tracking_item['date_shipped'] ) {
957
+ $tracking_item['date_shipped'] = time();
958
+ }
959
+
960
+ $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
961
+
962
+ $tracking_items = $this->get_tracking_items( $order_id );
963
+ $tracking_items[] = $tracking_item;
964
+
965
+ if($tracking_item['tracking_provider']){
966
+ $this->save_tracking_items( $order_id, $tracking_items );
967
+ }
968
+
969
+ if( !empty($tracking_item['status_shipped'] )){
970
+ $order = new WC_Order( $order_id );
971
+ $order->update_status('completed');
972
+ }
973
+ return $tracking_item;
974
+ }
975
+
976
+
977
 
978
  /**
979
  * Saves the tracking items array to post_meta.
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
- //$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 ) ) );
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' => __( 'To', 'woo-advanced-shipment-tracking' ),
212
- 'description' => esc_html__( 'Enter emails here or 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,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 placeholders: {site_title}, {order_number}', 'woo-advanced-shipment-tracking' ),
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 placeholders: {site_title}, {order_number}', 'woo-advanced-shipment-tracking' ),
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' => __( 'Show tracking details', 'woo-advanced-shipment-tracking' ),
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' => __( 'Show order details', 'woo-advanced-shipment-tracking' ),
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( 'wcast_show_billing_address',
303
  array(
304
- 'default' => $this->defaults['wcast_show_billing_address'],
305
  'transport' => 'refresh',
306
  'sanitize_callback' => ''
307
  )
308
  );
309
- $wp_customize->add_control( 'wcast_show_billing_address',
310
  array(
311
- 'label' => __( 'Show billing address', 'woo-advanced-shipment-tracking' ),
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( 'wcast_show_shipping_address',
320
  array(
321
- 'default' => $this->defaults['wcast_show_shipping_address'],
322
  'transport' => 'refresh',
323
  'sanitize_callback' => ''
324
  )
325
  );
326
- $wp_customize->add_control( 'wcast_show_shipping_address',
327
  array(
328
- 'label' => __( 'Show shipping address', 'woo-advanced-shipment-tracking' ),
329
  'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
330
  'section' => 'customer_delivered_email',
331
  'type' => 'checkbox'
332
  )
333
  );
334
-
335
- // Test of TinyMCE control
336
- $wp_customize->add_setting( 'wcast_delivered_email_content',
337
  array(
338
- 'default' => $this->defaults['wcast_delivered_email_content'],
339
  'transport' => 'refresh',
340
- 'sanitize_callback' => 'wp_kses_post'
341
  )
342
  );
343
- $wp_customize->add_control( new Skyrocket_TinyMCE_Custom_control( $wp_customize, 'wcast_delivered_email_content',
344
  array(
345
- 'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
346
- 'description' => __( '', 'woo-advanced-shipment-tracking' ),
347
  'section' => 'customer_delivered_email',
348
- 'input_attrs' => array(
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
- <!--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">
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
- <?php if($wc_ast_api_key){ ?>
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. This plugin provides a list of 100+ Shipping Providers and you can also add your own custom providers.
16
 
17
- Shop managers can add shipment provider, tracking number and date to orders, the customer will receive tracking info and track link in the orders email and in Customer accounts.
18
 
19
- Use WooCommerce Advanced Shipment Tracking to streamline your order management, add shipment tracking information to orders, auto track orders ([TracksShip](https://trackship.info/)) and provide superior post-purchase experience that your customers will love and appreciate!
20
 
21
  == Features ==
22
 
23
- * Add shipment tracking info to orders – Shipping provider, tracking number and ship date.
24
  * Add multiple tracking numbers to orders
25
- * List of more then 100 shipping providers (carriers)
 
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
- Auto-track all your WooCommerce shipments with [TracksShip](https://trackship.info/). Get real-time shipment updates and automate your order management flow to increase your customers satisfaction and further engage customers.
 
 
 
 
 
 
 
 
 
 
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=sQc2kVnUL-o&t=2s
68
 
69
  == Frequently Asked Questions ==
70
 
@@ -106,6 +118,34 @@ 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.2 =
122
+ * Fixed issue in tracking page for unknown status
123
+ * Added PostNL International 3S,GLS Europe and Yun Express Tracking provider
124
+ * In tracking url added two more parameter - %country_code% and %postal_code%
125
+ * Updated code for add tracking item programatically
126
+ * Updated tracking page endpoint
127
+ * Removed Tracking URL validation for add/edit custom shiping provider and if not added tracking url than not display track button
128
+
129
+ = 2.4.1 =
130
+ * Fixed Hermes World shipping provider issue
131
+ * Fixed warnings Undefined index: Hermes Germany
132
+ * Updated completed order status to shipped on "On which customer order status email to include tracking info?" is "Rename the “Completed” Order status to “Shipped”" enabled
133
+
134
+ = 2.4 =
135
+ * Fixed warnings in tracking page
136
+ * Fixed error from customizer if WooCommerce uninstalled
137
+ * Fixed date format issue in Bulk Upload
138
+ * Addes Sync Providers List functionality for all users
139
+ * Added Hermes World Shipping provider
140
+ * Added option for "mark as shipped" will be selected by default when adding tracking info to orders
141
+ * Added Shipment Status filter in order list panel
142
+ * Updated Delivered orderemail customizer layout and Google analytics tracking
143
+ * Updated tracking page design
144
+
145
+ = 2.3.9 =
146
+ * Added "DHL Freight" provider
147
+ * Added functionality when check connection store status if api key is not available in plugin than add it
148
+
149
  = 2.3.8 =
150
  * Fixed - Trackship connection issue when trackship setting saved
151
 
templates/emails/tracking-info.php CHANGED
@@ -105,7 +105,7 @@ if ( $tracking_items ) :
105
  </thead>
106
 
107
  <tbody><?php
108
- foreach ( $tracking_items as $tracking_item ) {
109
  ?><tr class="tracking">
110
  <td class="tracking-provider" data-title="<?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
111
  <?php
@@ -114,7 +114,7 @@ if ( $tracking_items ) :
114
  $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_item['formatted_tracking_provider']."'" );
115
  $custom_thumb_id = $shippment_provider['0']->custom_thumb_id;
116
  //echo $custom_thumb_id;
117
- if($custom_thumb_id == 0){
118
  $src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/".sanitize_title($tracking_item['formatted_tracking_provider']).".png";
119
  } else{
120
  $image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
@@ -147,8 +147,10 @@ if ( $tracking_items ) :
147
  } ?>
148
 
149
  <td class="order-actions" style="<?php echo $td_column_style; ?>">
150
- <?php $url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
151
- <a href="<?php echo esc_url( $url ); ?>" style="<?php echo $tracking_link_style; ?>" target="_blank"><?php _e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
 
 
152
  </td>
153
  </tr><?php
154
  }
105
  </thead>
106
 
107
  <tbody><?php
108
+ foreach ( $tracking_items as $tracking_item ) {
109
  ?><tr class="tracking">
110
  <td class="tracking-provider" data-title="<?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
111
  <?php
114
  $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_item['formatted_tracking_provider']."'" );
115
  $custom_thumb_id = $shippment_provider['0']->custom_thumb_id;
116
  //echo $custom_thumb_id;
117
+ if($custom_thumb_id == 0 && $shippment_provider['0']->shipping_default == 1){
118
  $src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/".sanitize_title($tracking_item['formatted_tracking_provider']).".png";
119
  } else{
120
  $image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
147
  } ?>
148
 
149
  <td class="order-actions" style="<?php echo $td_column_style; ?>">
150
+ <?php if($tracking_item['formatted_tracking_link']){ ?>
151
+ <?php $url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
152
+ <a href="<?php echo esc_url( $url ); ?>" style="<?php echo $tracking_link_style; ?>" target="_blank"><?php _e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
153
+ <?php } ?>
154
  </td>
155
  </tr><?php
156
  }
templates/myaccount/view-order.php CHANGED
@@ -94,7 +94,7 @@ if ( $tracking_items ) :
94
  $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_item['formatted_tracking_provider']."'" );
95
  $custom_thumb_id = $shippment_provider['0']->custom_thumb_id;
96
  //echo $custom_thumb_id;
97
- if($custom_thumb_id == 0){
98
  $src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/".sanitize_title($tracking_item['formatted_tracking_provider']).".png";
99
  } else{
100
  $image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
94
  $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_item['formatted_tracking_provider']."'" );
95
  $custom_thumb_id = $shippment_provider['0']->custom_thumb_id;
96
  //echo $custom_thumb_id;
97
+ if($custom_thumb_id == 0 && $shippment_provider['0']->shipping_default == 1){
98
  $src = wc_advanced_shipment_tracking()->plugin_dir_url()."assets/shipment-provider-img/".sanitize_title($tracking_item['formatted_tracking_provider']).".png";
99
  } else{
100
  $image_attributes = wp_get_attachment_image_src( $custom_thumb_id , array('60','60') );
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.3.8
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.6.5
15
  */
16
 
17
 
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
22
  *
23
  * @var string
24
  */
25
- public $version = '2.3.8';
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
- add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
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' ) );
@@ -321,12 +323,12 @@ class zorem_woocommerce_advanced_shipment_tracking {
321
  WC()->api->WC_Advanced_Shipment_Tracking_REST_API_Controller->register_routes();
322
 
323
  }
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.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.7
15
  */
16
 
17
 
22
  *
23
  * @var string
24
  */
25
+ public $version = '2.4.2';
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' ) );
323
  WC()->api->WC_Advanced_Shipment_Tracking_REST_API_Controller->register_routes();
324
 
325
  }
326
+ public function on_plugins_loaded() {
327
+ require_once $this->get_plugin_path() . '/includes/email-manager.php';
328
 
329
+ require_once $this->get_plugin_path() . '/includes/customizer/class-wcast-customizer.php';
330
 
331
+ require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
332
 
333
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
334