Advanced Shipment Tracking for WooCommerce - Version 2.4.3

Version Description

  • Fixed issue with TranslatePress plugin
  • Fixed issue in tracking page
  • Fixed issue if ts_slug field not created in database
  • Added compatibility with WP-Lister for eBay
  • Added hook for order number in tracking page
Download this release

Release Info

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

Code changes from version 2.3.8 to 2.4.3

Files changed (31) hide show
  1. assets/css/admin.css +41 -0
  2. assets/css/front.css +20 -3
  3. assets/css/icons/invalid-user-key-v4.png +0 -0
  4. assets/js/customizer-scripts.js +11 -0
  5. assets/js/shipping_row.js +14 -5
  6. assets/shipment-provider-img/dhl-express-uk.png +0 -0
  7. assets/shipment-provider-img/dhl-parcel-uk.png +0 -0
  8. assets/shipment-provider-img/gls-europe.png +0 -0
  9. assets/shipment-provider-img/gls-italy.png +0 -0
  10. assets/shipment-provider-img/{hermes.png → hermes-germany.png} +0 -0
  11. assets/shipment-provider-img/hermes-world.png +0 -0
  12. assets/shipment-provider-img/malaysia-post.png +0 -0
  13. assets/shipment-provider-img/postnl-international-3s.png +0 -0
  14. assets/shipment-provider-img/xpressbees.png +0 -0
  15. assets/shipment-provider-img/yun-express-tracking.png +0 -0
  16. includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php +42 -2
  17. includes/class-wc-advanced-shipment-tracking-admin.php +267 -65
  18. includes/class-wc-advanced-shipment-tracking-api-call.php +15 -1
  19. includes/class-wc-advanced-shipment-tracking-front.php +191 -116
  20. includes/class-wc-advanced-shipment-tracking-install.php +142 -6
  21. includes/class-wc-advanced-shipment-tracking.php +136 -47
  22. includes/customizer/class-wc-availableforpickup-email-customizer.php +1 -1
  23. includes/customizer/class-wc-email-customizer.php +48 -28
  24. includes/emails/class-shipment-delivered-email.php +2 -1
  25. includes/views/admin_options_bulk_upload.php +1 -1
  26. includes/views/admin_options_settings (Eran Shor's conflicted copy 2019-08-07).php +0 -34
  27. includes/views/admin_options_shipping_provider.php +2 -4
  28. readme.txt +54 -7
  29. templates/emails/tracking-info.php +6 -4
  30. templates/myaccount/view-order.php +1 -1
  31. 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;
@@ -1621,6 +1644,24 @@ p.tracking-preview-desc {
1621
  width: 80%;
1622
  margin: 1em auto;
1623
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1624
  @media screen and (min-width: 1850px) {
1625
  .provider{
1626
  padding:10px;
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;
1644
  width: 80%;
1645
  margin: 1em auto;
1646
  }
1647
+
1648
+ /*** Dashboard Widget CSS ***/
1649
+ .ast-dashborad-widget.row{
1650
+ width: 100%;
1651
+ -js-display: flex;
1652
+ display: -ms-flexbox;
1653
+ display: flex;
1654
+ -ms-flex-flow: row wrap;
1655
+ flex-flow: row wrap;
1656
+ }
1657
+ .ast-dashborad-widget.row .large-6 {
1658
+ max-width: 47%;
1659
+ -ms-flex-preferred-size: 47%;
1660
+ flex-basis: 47%;
1661
+ position: relative;
1662
+ border: 1px dashed #ddd;
1663
+ padding: 5px;
1664
+ }
1665
  @media screen and (min-width: 1850px) {
1666
  .provider{
1667
  padding:10px;
assets/css/front.css CHANGED
@@ -19,7 +19,8 @@
19
  }
20
  .tracker-progress-bar-with-dots .progress {
21
  margin-bottom: 35px;
22
- height: 5px;
 
23
  }
24
  .tracker-progress-bar-with-dots .progress .progress-bar {
25
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.15)
@@ -38,7 +39,7 @@
38
  }
39
  .tracker-progress-bar-with-dots .state-3 {
40
  position: absolute;
41
- left: 100%
42
  }
43
  .tracker-progress-bar-with-dots .state-label {
44
  width: 75px;
@@ -361,6 +362,11 @@ table.tracking-table{
361
  .h4-heading{
362
  border-bottom: 1px solid #eee;
363
  }
 
 
 
 
 
364
  @media screen and (max-width: 767px) {
365
  .col.tracking-detail{
366
  padding: 20px 15px 0;
@@ -378,6 +384,11 @@ table.tracking-table{
378
  .status-section{
379
  max-width: 80%;
380
  }
 
 
 
 
 
381
  }
382
  @media screen and (max-width: 550px) {
383
  .mobile-section{
@@ -423,8 +434,9 @@ table.tracking-table{
423
  }
424
  .mobile-section .tracker-progress-bar.tracker-progress-bar-with-dots:before {
425
  content: '';
426
- height: 100%;
427
  position: absolute;
 
428
  left: 48px;
429
  width: 5px;
430
  background-color: #C1C1C1;
@@ -450,4 +462,9 @@ table.tracking-table{
450
  margin-top: 20px;
451
  padding-left: 20px;
452
  }
 
 
 
 
 
453
  }
19
  }
20
  .tracker-progress-bar-with-dots .progress {
21
  margin-bottom: 35px;
22
+ height: 5px;
23
+ margin-left: 15px;
24
  }
25
  .tracker-progress-bar-with-dots .progress .progress-bar {
26
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.15)
39
  }
40
  .tracker-progress-bar-with-dots .state-3 {
41
  position: absolute;
42
+ left: 95%
43
  }
44
  .tracker-progress-bar-with-dots .state-label {
45
  width: 75px;
362
  .h4-heading{
363
  border-bottom: 1px solid #eee;
364
  }
365
+ .tracker-progress-bar-with-dots .dot.past-state,.tracker-progress-bar-with-dots .dot.future-state{
366
+ background-size: 50px;
367
+ background-repeat: no-repeat;
368
+ background-position: center center;
369
+ }
370
  @media screen and (max-width: 767px) {
371
  .col.tracking-detail{
372
  padding: 20px 15px 0;
384
  .status-section{
385
  max-width: 80%;
386
  }
387
+ .tracker-progress-bar-with-dots .dot.past-state,.tracker-progress-bar-with-dots .dot.future-state{
388
+ background-size: 45px;
389
+ background-repeat: no-repeat;
390
+ background-position: center center;
391
+ }
392
  }
393
  @media screen and (max-width: 550px) {
394
  .mobile-section{
434
  }
435
  .mobile-section .tracker-progress-bar.tracker-progress-bar-with-dots:before {
436
  content: '';
437
+ height: 93%;
438
  position: absolute;
439
+ top: 10px;
440
  left: 48px;
441
  width: 5px;
442
  background-color: #C1C1C1;
462
  margin-top: 20px;
463
  padding-left: 20px;
464
  }
465
+ .tracker-progress-bar-with-dots .dot.past-state,.tracker-progress-bar-with-dots .dot.future-state{
466
+ background-size: 45px;
467
+ background-repeat: no-repeat;
468
+ background-position: center center;
469
+ }
470
  }
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/dhl-express-uk.png ADDED
Binary file
assets/shipment-provider-img/dhl-parcel-uk.png ADDED
Binary file
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/xpressbees.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
  /**
@@ -418,6 +430,34 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
418
  wp_reset_postdata();
419
  }
420
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  if ( ! $this->is_valid_order_id( $order_id ) ) {
422
  return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-shipment-tracking' ), array( 'status' => 404 ) );
423
  }
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
  /**
430
  wp_reset_postdata();
431
  }
432
  }
433
+
434
+ if ( is_plugin_active( 'wp-lister/wp-lister.php' ) || is_plugin_active( 'wp-lister-for-ebay/wp-lister.php' )) {
435
+ $args = array(
436
+ 'post_type' => 'shop_order',
437
+ 'posts_per_page' => '1',
438
+ 'meta_query' => array(
439
+ 'relation' => 'AND',
440
+ array(
441
+ 'key' => '_ebay_order_id',
442
+ 'value' => $order_id
443
+ ),
444
+ ),
445
+ 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
446
+ );
447
+ $posts = get_posts( $args );
448
+ $my_query = new WP_Query( $args );
449
+
450
+ if( $my_query->have_posts() ) {
451
+ while( $my_query->have_posts()) {
452
+ $my_query->the_post();
453
+ if(get_the_ID()){
454
+ $order_id = get_the_ID();
455
+ }
456
+ } // end while
457
+ } // end if
458
+ wp_reset_postdata();
459
+ }
460
+
461
  if ( ! $this->is_valid_order_id( $order_id ) ) {
462
  return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-shipment-tracking' ), array( 'status' => 404 ) );
463
  }
includes/class-wc-advanced-shipment-tracking-admin.php CHANGED
@@ -113,6 +113,12 @@ 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 +141,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 +169,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 +570,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 +718,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 +802,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 +1058,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 +1077,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 +1092,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' => '',
@@ -1270,6 +1293,33 @@ class WC_Advanced_Shipment_Tracking_Admin {
1270
  }
1271
  }
1272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1273
  $tracking_provider = $_POST['tracking_provider'];
1274
  $tracking_number = $_POST['tracking_number'];
1275
  $date_shipped = str_replace("/","-",$_POST['date_shipped']);
@@ -1277,7 +1327,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 +1354,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 +1509,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 +1552,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 +1913,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 +1962,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 +2061,195 @@ 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
+ //add_action( 'wp_dashboard_setup', array( $this, 'ast_add_dashboard_widgets') );
122
  }
123
 
124
  // trigger when order status changed to shipped or completed
141
  add_filter("trackship_status_filter", array($this, "trackship_status_filter_func"), 10 , 1);
142
 
143
  // filter for shipment status icon
144
+ add_filter("trackship_status_icon_filter", array($this, "trackship_status_icon_filter_func"), 10 , 2);
 
 
 
 
 
145
 
146
  add_action( 'wcast_retry_trackship_apicall', array( $this, 'wcast_retry_trackship_apicall_func' ) );
147
 
169
 
170
  add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
171
 
172
+ add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun') );
173
  }
174
 
175
  /*
570
  $has_est_delivery = false;
571
  $status = $shipment_status[$key]['status'];
572
  $status_date = $shipment_status[$key]['status_date'];
573
+ if(isset($shipment_status[$key]['est_delivery_date'])){
574
+ $est_delivery_date = $shipment_status[$key]['est_delivery_date'];
575
+ }
576
  if( $status != 'delivered' && $status != 'return_to_sender' && !empty($est_delivery_date) ){
577
  $has_est_delivery = true;
578
+ }
579
  ?>
580
  <li id="tracking-item-<?php echo $tracking_item['tracking_id'];?>" class="tracking-item-<?php echo $tracking_item['tracking_id'];?>">
581
  <div class="wcast-shipment-status-icon">
718
 
719
  }
720
  }
721
+ wp_enqueue_script( 'shipment_tracking_table_rows' );
722
  ?>
723
  <h1 class="plugin-title"><?php _e('Advanced Shipment Tracking', 'woo-advanced-shipment-tracking'); ?></h1>
724
  <div class="wrap woocommerce zorem_admin_layout">
802
  ?>
803
  <span class="mdl-list__item-secondary-action">
804
  <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="<?php echo $id?>">
805
+ <input type="hidden" name="<?php echo $id?>" value="0"/>
806
  <input type="checkbox" id="<?php echo $id?>" name="<?php echo $id?>" class="mdl-switch__input" <?php echo $checked ?> value="1"/>
807
  </label>
808
  </span>
1058
  } else{
1059
  $show_invoice_field = false;
1060
  }
1061
+
1062
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
1063
+ if($wc_ast_status_shipped == 1){
1064
+ $completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
1065
+ $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>" checkbox state', 'woo-advanced-shipment-tracking' );
1066
+ $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' );
1067
+ } else{
1068
+ $completed_order_label = __( 'Completed', 'woo-advanced-shipment-tracking' );
1069
+ $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">completed</span>" checkbox state', 'woo-advanced-shipment-tracking' );
1070
+ $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' );
1071
+ }
1072
+
1073
  $form_data = array(
1074
  'wc_ast_status_shipped' => array(
1075
  'type' => 'checkbox',
1077
  'show' => true,
1078
  'class' => '',
1079
  ),
1080
+ 'wc_ast_default_mark_shipped' => array(
1081
+ 'type' => 'checkbox',
1082
+ 'title' => $mark_as_shipped_label,
1083
+ 'tooltip' => $mark_as_shipped_tooltip,
1084
+ 'show' => true,
1085
+ 'class' => '',
1086
+ ),
1087
  'wc_ast_unclude_tracking_info' => array(
1088
  'type' => 'multiple_checkbox',
1089
  'title' => __( 'On which customer order status email to include tracking info?', 'woo-advanced-shipment-tracking' ),'options' => array(
1092
  "show_in_refunded" =>__( 'Refunded', 'woo-advanced-shipment-tracking' ),
1093
  "show_in_processing" =>__( 'Processing', 'woo-advanced-shipment-tracking' ),
1094
  "show_in_failed" =>__( 'Failed', 'woo-advanced-shipment-tracking' ),
1095
+ "show_in_completed" =>__( $completed_order_label, 'woo-advanced-shipment-tracking' ),
1096
  ),
1097
  'show' => true,
1098
  'class' => '',
1293
  }
1294
  }
1295
 
1296
+ if ( is_plugin_active( 'wp-lister/wp-lister.php' ) || is_plugin_active( 'wp-lister-for-ebay/wp-lister.php' )) {
1297
+ $args = array(
1298
+ 'post_type' => 'shop_order',
1299
+ 'posts_per_page' => '1',
1300
+ 'meta_query' => array(
1301
+ 'relation' => 'AND',
1302
+ array(
1303
+ 'key' => '_ebay_order_id',
1304
+ 'value' => $order_id
1305
+ ),
1306
+ ),
1307
+ 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
1308
+ );
1309
+ $posts = get_posts( $args );
1310
+ $my_query = new WP_Query( $args );
1311
+
1312
+ if( $my_query->have_posts() ) {
1313
+ while( $my_query->have_posts()) {
1314
+ $my_query->the_post();
1315
+ if(get_the_ID()){
1316
+ $order_id = get_the_ID();
1317
+ }
1318
+ } // end while
1319
+ } // end if
1320
+ wp_reset_postdata();
1321
+ }
1322
+
1323
  $tracking_provider = $_POST['tracking_provider'];
1324
  $tracking_number = $_POST['tracking_number'];
1325
  $date_shipped = str_replace("/","-",$_POST['date_shipped']);
1327
  $date_shipped = date("d-m-Y");
1328
  }
1329
  $replace_tracking_info = $_POST['replace_tracking_info'];
1330
+
1331
  global $wpdb;
1332
  $woo_shippment_table_name = $this->table;
1333
  $shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
1354
  if ( count( $tracking_items ) > 0 ) {
1355
  foreach ( $tracking_items as $key => $item ) {
1356
  $tracking_number = $item['tracking_number'];
1357
+ //echo '<pre>';print_r($tracking_number);echo '</pre>';exit;
1358
  if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
1359
 
1360
  } else{
1509
  case "carrier_unsupported":
1510
  $status = __( 'Carrier unsupported', 'woo-advanced-shipment-tracking' );
1511
  break;
1512
+ case "invalid_user_key":
1513
+ $status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
1514
+ break;
1515
+
1516
  }
1517
  return $status;
1518
  }
1552
  case "INVALID_TRACKING_NUM":
1553
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1554
  break;
1555
+ case "invalid_user_key":
1556
+ $html = '<span class="icon-'.$status.'">';
1557
+ break;
1558
  default:
1559
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1560
  break;
1561
 
1562
  }
1563
  return $html;
1564
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1565
 
1566
  /*
1567
  * retry trackship api call
1913
  }
1914
 
1915
  public function sync_providers_fun(){
1916
+ global $wpdb;
1917
+
1918
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1919
+ $resp = wp_remote_get( $url );
 
 
 
 
 
1920
  $providers = json_decode($resp['body'],true);
1921
 
1922
  $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
1962
  }
1963
  } else{
1964
  $img_url = $provider['img_url'];
1965
+
1966
  $img_slug = sanitize_title($provider_name);
1967
  $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1968
 
2061
  <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>
2062
  <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>
2063
  <?php }
2064
+ /**
2065
+ * Add bulk filter for Shipment status in orders list
2066
+ *
2067
+ * @since 2.4
2068
+ */
2069
+ public function filter_orders_by_shipment_status(){
2070
+ global $typenow;
2071
+
2072
+ if ( 'shop_order' === $typenow ) {
2073
+
2074
+ $count = $this->get_order_count();
2075
+
2076
+ $terms = array(
2077
+ 'unknown' => (object) array( 'count' => $count['unknown'], 'term' => __( 'Unknown', 'woo-advanced-shipment-tracking' ) ),
2078
+ 'pre_transit' => (object) array( 'count' => $count['pre_transit'],'term' => __( 'Pre Transit', 'woo-advanced-shipment-tracking' ) ),
2079
+ 'in_transit' => (object) array( 'count' => $count['in_transit'],'term' => __( 'In Transit', 'woo-advanced-shipment-tracking' ) ),
2080
+ 'available_for_pickup' => (object) array( 'count' => $count['available_for_pickup'],'term' => __( 'Available for Pickup', 'woo-advanced-shipment-tracking' ) ),
2081
+ 'out_for_delivery' => (object) array( 'count' => $count['out_for_delivery'],'term' => __( 'Out for Delivery', 'woo-advanced-shipment-tracking' ) ),
2082
+ 'delivered' => (object) array( 'count' => $count['delivered'],'term' => __( 'Delivered', 'woo-advanced-shipment-tracking' ) ),
2083
+ 'failed_attempt' => (object) array( 'count' => $count['failed_attempt'],'term' => __( 'Failed Attempt', 'woo-advanced-shipment-tracking' ) ),
2084
+ 'cancelled' => (object) array( 'count' => $count['cancelled'],'term' => __( 'Cancelled', 'woo-advanced-shipment-tracking' ) ),
2085
+ 'carrier_unsupported' => (object) array( 'count' => $count['carrier_unsupported'],'term' => __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' ) ),
2086
+ 'return_to_sender' => (object) array( 'count' => $count['return_to_sender'],'term' => __( 'Return To Sender', 'woo-advanced-shipment-tracking' ) ),
2087
+ 'INVALID_TRACKING_NUM' => (object) array( 'count' => $count['invalid_tracking_number'],'term' => __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' ) ),
2088
+ );
2089
+
2090
+ ?>
2091
+ <select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
2092
+ <option value=""><?php _e( 'Filter by shipment status', 'woo-advanced-shipment-tracking' ); ?></option>
2093
+ <?php foreach ( $terms as $value => $term ) : ?>
2094
+ <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 ) : '' ); ?>>
2095
+ <?php printf( '%1$s (%2$s)', esc_html( $term->term ), esc_html( $term->count ) ); ?>
2096
+ </option>
2097
+ <?php endforeach; ?>
2098
+ </select>
2099
+ <?php
2100
+ }
2101
+ }
2102
+
2103
+ /**
2104
+ * Get the order count for orders by shipment status
2105
+ * @since 2.4
2106
+ */
2107
+ private function get_order_count() {
2108
+
2109
+ $query_args = array(
2110
+ 'fields' => 'ids',
2111
+ 'post_type' => 'shop_order',
2112
+ 'post_status' => isset( $_GET['post_status'] ) ? $_GET['post_status'] : 'any',
2113
+ 'meta_query' => array(
2114
+ array(
2115
+ 'key' => 'shipment_status',
2116
+ 'value' => '',
2117
+ 'compare' => 'LIKE',
2118
+ )
2119
+ ),
2120
+ 'nopaging' => true,
2121
+ );
2122
+
2123
+ $order_query = new WP_Query( $query_args );
2124
+
2125
+ $query_args['meta_query'][0]['value'] = 'delivered';
2126
+ $delivered_query = new WP_Query( $query_args );
2127
+
2128
+ $query_args['meta_query'][0]['value'] = 'unknown';
2129
+ $unknown_query = new WP_Query( $query_args );
2130
+
2131
+ $query_args['meta_query'][0]['value'] = 'pre_transit';
2132
+ $pre_transit_query = new WP_Query( $query_args );
2133
+
2134
+ $query_args['meta_query'][0]['value'] = 'in_transit';
2135
+ $in_transit_query = new WP_Query( $query_args );
2136
+
2137
+ $query_args['meta_query'][0]['value'] = 'available_for_pickup';
2138
+ $available_for_pickup_query = new WP_Query( $query_args );
2139
+
2140
+ $query_args['meta_query'][0]['value'] = 'out_for_delivery';
2141
+ $out_for_delivery_query = new WP_Query( $query_args );
2142
+
2143
+ $query_args['meta_query'][0]['value'] = 'failed_attempt';
2144
+ $failed_attempt_query = new WP_Query( $query_args );
2145
+
2146
+ $query_args['meta_query'][0]['value'] = 'cancelled';
2147
+ $cancelled_query = new WP_Query( $query_args );
2148
+
2149
+ $query_args['meta_query'][0]['value'] = 'carrier_unsupported';
2150
+ $carrier_unsupported_query = new WP_Query( $query_args );
2151
+
2152
+ $query_args['meta_query'][0]['value'] = 'return_to_sender';
2153
+ $return_to_sender_query = new WP_Query( $query_args );
2154
+
2155
+ $query_args['meta_query'][0]['value'] = 'INVALID_TRACKING_NUM';
2156
+ $invalid_tracking_number_query = new WP_Query( $query_args );
2157
+
2158
+ 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);
2159
+ }
2160
+ /**
2161
+ * Process bulk filter action for shipment status orders
2162
+ *
2163
+ * @since 3.0.0
2164
+ * @param array $vars query vars without filtering
2165
+ * @return array $vars query vars with (maybe) filtering
2166
+ */
2167
+ public function filter_orders_by_shipment_status_query( $vars ){
2168
+ global $typenow;
2169
+
2170
+ if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] )) {
2171
+ $vars['meta_key'] = 'shipment_status';
2172
+ $vars['meta_value'] = $_GET['_shop_order_shipment_status'];
2173
+ $vars['meta_compare'] = 'LIKE';
2174
+ }
2175
+
2176
+ return $vars;
2177
+ }
2178
+ /**
2179
+ * Add a new dashboard widget.
2180
+ */
2181
+ public function ast_add_dashboard_widgets() {
2182
+ wp_add_dashboard_widget( 'dashboard_widget', 'TrackShip Reports', array( $this, 'dashboard_widget_function') );
2183
+ }
2184
+ /**
2185
+ * Output the contents of the dashboard widget
2186
+ */
2187
+ public function dashboard_widget_function( $post, $callback_args ) { ?>
2188
+ <div class="ast-dashborad-widget row align-equal row-dashed" id="">
2189
+ <div class="col medium-6 small-12 large-6">
2190
+ <div class="col-inner">
2191
+ <p data-line-height="s"><strong>Shipment Trackers</strong></p>
2192
+ <p><span style="font-size: 100%;"><span style="font-size: 200%;" data-text-color="primary">7</span>
2193
+ <span class="ft12 red">42% <i class="fa fa-arrow-down"></i></span></span>
2194
+ </p>
2195
+ </div>
2196
+ </div>
2197
+ <div class="col medium-6 small-12 large-6">
2198
+ <div class="col-inner">
2199
+ <p data-line-height="s"><strong>Shipment Providers</strong></p>
2200
+ <table class="table">
2201
+ <tbody>
2202
+ <tr class="card-category">
2203
+ <td><strong>ups</strong></td>
2204
+ <td>3</td>
2205
+ <td><span class="ft12 green">0% <i class="fa fa-arrow-up"></i></span></td>
2206
+ </tr>
2207
+ <tr class="card-category">
2208
+ <td><strong>usps</strong></td>
2209
+ <td>2</td>
2210
+ <td><span class="ft12 red">33% <i class="fa fa-arrow-down"></i></span></td>
2211
+ </tr>
2212
+ <tr class="card-category">
2213
+ <td><strong>dhlparcel-nl</strong></td>
2214
+ <td>1</td>
2215
+ <td><span class="ft12 green">100% <i class="fa fa-arrow-up"></i></span></td>
2216
+ </tr>
2217
+ </tbody>
2218
+ </table>
2219
+ </div>
2220
+ </div>
2221
+ <div class="col medium-6 small-12 large-6">
2222
+ <div class="col-inner">
2223
+ <p data-line-height="s"><strong>Shipment Status</strong></p>
2224
+ <p data-line-height="s">
2225
+ </p>
2226
+ <table class="table">
2227
+ <tbody>
2228
+ <tr class="card-category">
2229
+ <td><strong>Delivered</strong></td>
2230
+ <td>6</td>
2231
+ <td><span class="ft12 red">45% <i class="fa fa-arrow-down"></i></span></td>
2232
+ </tr>
2233
+ <tr class="card-category">
2234
+ <td><strong>Return to sender</strong></td>
2235
+ <td>1</td>
2236
+ <td><span class="ft12 green">100% <i class="fa fa-arrow-up"></i></span></td>
2237
+ </tr>
2238
+ </tbody>
2239
+ </table>
2240
+ </div>
2241
+ </div>
2242
+ <div class="col medium-6 small-12 large-6">
2243
+ <div class="col-inner">
2244
+ <p data-line-height="s"><strong>Tracking Issues</strong></p>
2245
+ <table class="table">
2246
+ <tbody>
2247
+ </tbody>
2248
+ </table>
2249
+ </div>
2250
+ </div>
2251
+ <style scope="scope">
2252
+ </style>
2253
+ </div>
2254
+ <?php }
2255
  }
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
@@ -15,6 +15,21 @@ class WC_Advanced_Shipment_Tracking_Front {
15
  * Initialize the main plugin function
16
  */
17
  public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  $this->init();
20
  }
@@ -50,6 +65,7 @@ class WC_Advanced_Shipment_Tracking_Front {
50
  wp_enqueue_style( 'front_style', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/front.css', array(), wc_advanced_shipment_tracking()->version );
51
  }
52
  public function woo_track_order_function(){
 
53
  $wc_ast_api_key = get_option('wc_ast_api_key');
54
  $primary_color = get_option('wc_ast_select_primary_color');
55
  $success_color = get_option('wc_ast_select_success_color');
@@ -57,31 +73,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,23 +111,22 @@ 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);
136
  }
137
 
138
  }
 
139
  ?>
140
 
141
  <?php
@@ -223,26 +214,66 @@ class WC_Advanced_Shipment_Tracking_Front {
223
  }
224
  }
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 +285,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';
@@ -269,7 +302,8 @@ class WC_Advanced_Shipment_Tracking_Front {
269
  $state2_class = 'available_for_pickup';
270
  } else{
271
  $state2_class = 'out_for_delivery';
272
- }
 
273
  ?>
274
 
275
  <div class="tracking-detail col">
@@ -279,8 +313,8 @@ class WC_Advanced_Shipment_Tracking_Front {
279
  <?php } ?>
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">
@@ -297,15 +331,15 @@ class WC_Advanced_Shipment_Tracking_Front {
297
  <?php } ?>
298
  </div>
299
  </div>
300
-
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 +349,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 +367,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 +378,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 +396,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,25 +418,21 @@ 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>
392
 
393
  </div>
394
  </div>
395
- </div>
396
-
 
397
  <div class="shipment_progress_div">
398
- <div class="shipment_progress_heading_div">
399
- <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){?>
400
- <h4 class="tracking-number h4-heading" style=""><?php _e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
401
- <?php } ?>
402
- </div>
403
- <?php if( sizeof($trackind_detail_by_status_rev) > 0 ){
404
- //echo '<pre>';print_r($trackind_detail_by_status_rev);echo '</pre>';
405
- ?>
406
  <table class="tracking-table">
407
  <tbody>
408
  <?php
@@ -421,8 +451,9 @@ class WC_Advanced_Shipment_Tracking_Front {
421
 
422
  <a class="view_table_rows" href="javaScript:void(0);"><?php _e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
423
  <a class="hide_table_rows" href="javaScript:void(0);"><?php _e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
424
- <?php } } ?>
425
- </div>
 
426
  </div>
427
  <?php } else{ ?>
428
  <div class="tracking-detail col">
@@ -441,11 +472,13 @@ class WC_Advanced_Shipment_Tracking_Front {
441
  <?php } }
442
 
443
  public function get_tracking_info_fun(){
 
444
  $wc_ast_api_key = get_option('wc_ast_api_key');
445
  if(!$wc_ast_api_key){
446
  return;
447
  }
448
  $order_id = $_POST['order_id'];
 
449
  $email = $_POST['order_email'];
450
  if ( is_plugin_active( 'custom-order-numbers-for-woocommerce/custom-order-numbers-for-woocommerce.php' ) ) {
451
  $alg_wc_custom_order_numbers_enabled = get_option('alg_wc_custom_order_numbers_enabled');
@@ -514,7 +547,34 @@ 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,16 +605,33 @@ 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");
560
  exit;
@@ -584,7 +661,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 ){ ?>
@@ -593,8 +670,8 @@ class WC_Advanced_Shipment_Tracking_Front {
593
  <?php } ?>
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">
@@ -611,15 +688,16 @@ class WC_Advanced_Shipment_Tracking_Front {
611
  <?php } ?>
612
  </div>
613
  </div>
614
-
 
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 +707,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 +725,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 +736,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 +754,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 +776,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>
@@ -707,16 +785,12 @@ class WC_Advanced_Shipment_Tracking_Front {
707
  </div>
708
  </div>
709
  </div>
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>
722
  <?php
@@ -735,9 +809,10 @@ class WC_Advanced_Shipment_Tracking_Front {
735
 
736
  <a class="view_table_rows" href="javaScript:void(0);"><?php _e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
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 +888,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 +990,4 @@ $wc_ast_api_key = get_option('wc_ast_api_key');
915
  get_footer();
916
  exit;
917
  }
918
- }
15
  * Initialize the main plugin function
16
  */
17
  public function __construct() {
18
+ global $wpdb;
19
+ $this->table = $wpdb->prefix."woo_shippment_provider";
20
+ if( is_multisite() ){
21
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
22
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
23
+ }
24
+ if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
25
+ $main_blog_prefix = $wpdb->get_blog_prefix(BLOG_ID_CURRENT_SITE);
26
+ $this->table = $main_blog_prefix."woo_shippment_provider";
27
+ } else{
28
+ $this->table = $wpdb->prefix."woo_shippment_provider";
29
+ }
30
+ } else{
31
+ $this->table = $wpdb->prefix."woo_shippment_provider";
32
+ }
33
 
34
  $this->init();
35
  }
65
  wp_enqueue_style( 'front_style', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/front.css', array(), wc_advanced_shipment_tracking()->version );
66
  }
67
  public function woo_track_order_function(){
68
+ global $wpdb;
69
  $wc_ast_api_key = get_option('wc_ast_api_key');
70
  $primary_color = get_option('wc_ast_select_primary_color');
71
  $success_color = get_option('wc_ast_select_success_color');
73
  $border_color = get_option('wc_ast_select_border_color');
74
  ?>
75
  <style>
76
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  <?php if($primary_color){ ?>
78
  .bg-secondary{
79
  background-color:<?php echo $primary_color; ?> !important;
111
  if($order_key != $_GET['order_key']){
112
  return;
113
  }
114
+
115
  if(!get_post_status( $order_id )){
116
  return;
117
  }
118
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
119
+ $tracking_items = get_post_meta( $order_id, '_wc_shipment_tracking_items', true );
 
120
  } else {
121
  $order = new WC_Order( $order_id );
122
+ $tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
 
123
  }
124
  if(!$tracking_items){
125
  unset($order_id);
126
  }
127
 
128
  }
129
+
130
  ?>
131
 
132
  <?php
214
  }
215
  }
216
 
217
+ if ( is_plugin_active( 'wp-lister/wp-lister.php' ) ) {
218
+ $args = array(
219
+ 'post_type' => 'shop_order',
220
+ 'posts_per_page' => '1',
221
+ 'meta_query' => array(
222
+ 'relation' => 'AND',
223
+ array(
224
+ 'key' => '_ebay_order_id',
225
+ 'value' => $order_id
226
+ ),
227
+ ),
228
+ 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
229
+ );
230
+ $posts = get_posts( $args );
231
+ $my_query = new WP_Query( $args );
232
+
233
+ if( $my_query->have_posts() ) {
234
+ while( $my_query->have_posts()) {
235
+ $my_query->the_post();
236
+ if(get_the_ID()){
237
+ $order_id = get_the_ID();
238
+ }
239
+ } // end while
240
+ } // end if
241
+ wp_reset_postdata();
242
+ }
243
+
244
  $num = 1;
245
+ $total_trackings = sizeof($tracking_items);
246
+
247
  foreach($tracking_items as $item){
248
+
249
  $tracking_number = $item['tracking_number'];
250
  $trackship_url = 'https://trackship.info';
251
+ $tracking_provider = $item['tracking_provider'];
252
+ $results = $wpdb->get_row( "SELECT * FROM {$this->table} WHERE ts_slug= '{$tracking_provider}'");
253
+ $tracking_provider = $results->provider_name;
254
+ //echo '<pre>';print_r($results);echo '</pre>';
255
+ //echo get_site_url();exit;
256
+ /*** Update in 2.4.1
257
+ * Change URL
258
+ * Add User Key
259
+ ***/
260
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info';
261
  $args['body'] = array(
262
+ 'tracking_number' => $tracking_number,
263
+ 'order_id' => $order_id,
264
+ 'domain' => get_home_url(),
265
+ 'user_key' => $wc_ast_api_key,
266
  );
267
  $response = wp_remote_post( $url, $args );
268
  $data = $response['body'];
269
  $decoded_data = json_decode($data);
270
+ $tracker->ep_status = '';
271
  if(!empty($decoded_data)){
272
  $tracker = $decoded_data[0];
273
  }
274
 
275
+ $tracking_detail_org = '';
276
+ $trackind_detail_by_status_rev = '';
 
277
 
278
  if(isset($tracker->tracking_detail) && $tracker->tracking_detail != 'null'){
279
  $tracking_detail = array_reverse(json_decode($tracker->tracking_detail));
285
  $trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
286
  }
287
 
 
 
 
 
 
288
 
289
+ if(!empty($decoded_data)){
290
+
291
+ if($tracker->est_delivery_date){
292
+ $unixTimestamp = strtotime($tracker->est_delivery_date);
293
+ $day = date("l", $unixTimestamp);
294
+ }
295
+
296
  if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
297
  if($tracker->ep_status == "return_to_sender" ){
298
  $state2_class = 'return_to_sender';
302
  $state2_class = 'available_for_pickup';
303
  } else{
304
  $state2_class = 'out_for_delivery';
305
+ }
306
+
307
  ?>
308
 
309
  <div class="tracking-detail col">
313
  <?php } ?>
314
  <div class="tracking-header">
315
  <div class="col-md col-md-6">
316
+ <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></span><br/>
317
+ <?php echo $tracking_provider; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
318
  <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>
319
  </div>
320
  <div class="col-md col-md-6">
331
  <?php } ?>
332
  </div>
333
  </div>
334
+ <?php if(isset($tracker->ep_status)){ ?>
335
  <div class="status-section desktop-section">
336
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
337
  <div class="progress">
338
+ <div class="progress-bar"></div>
339
  </div>
340
  <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';} ?>">
341
+ <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>
342
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
343
  <?php
344
  if($tracker->ep_status == "unknown"){
345
  echo apply_filters("trackship_status_filter",'unknown');
349
  ?>
350
  </span>
351
 
352
+ <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>
353
+ <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'; } ?>">
354
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
355
  </span>
356
 
357
+ <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>
358
+ <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'; } ?>">
359
  <?php
360
  if($tracker->ep_status == "return_to_sender"){
361
  echo apply_filters("trackship_status_filter",'return_to_sender');
367
  ?>
368
  </span>
369
 
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>
378
  <div class="status-section mobile-section">
379
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
380
  <div class="progress">
381
+ <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>
382
  </div>
383
  <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';} ?>">
384
 
385
  <div class="dot-div">
386
+ <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>
387
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
388
  <?php
389
  if($tracker->ep_status == "unknown"){
390
  echo apply_filters("trackship_status_filter",'unknown');
396
  </div>
397
 
398
  <div class="dot-div">
399
+ <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>
400
+ <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'; } ?>">
401
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
402
  </span>
403
  </div>
404
 
405
  <div class="dot-div">
406
+ <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>
407
+ <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'; } ?>">
408
  <?php
409
  if($tracker->ep_status == "return_to_sender"){
410
  echo apply_filters("trackship_status_filter",'return_to_sender');
418
  </div>
419
 
420
  <div class="dot-div">
421
+ <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>
422
+ <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'; }?>">
423
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
424
  </span>
425
  </div>
426
 
427
  </div>
428
  </div>
429
+ </div>
430
+ <?php } ?>
431
+ <?php if( !empty($trackind_detail_by_status_rev) ){ ?>
432
  <div class="shipment_progress_div">
433
+ <div class="shipment_progress_heading_div">
434
+ <h4 class="tracking-number h4-heading" style=""><?php _e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
435
+ </div>
 
 
 
 
 
436
  <table class="tracking-table">
437
  <tbody>
438
  <?php
451
 
452
  <a class="view_table_rows" href="javaScript:void(0);"><?php _e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
453
  <a class="hide_table_rows" href="javaScript:void(0);"><?php _e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
454
+ <?php } ?>
455
+ </div>
456
+ <?php } ?>
457
  </div>
458
  <?php } else{ ?>
459
  <div class="tracking-detail col">
472
  <?php } }
473
 
474
  public function get_tracking_info_fun(){
475
+ global $wpdb;
476
  $wc_ast_api_key = get_option('wc_ast_api_key');
477
  if(!$wc_ast_api_key){
478
  return;
479
  }
480
  $order_id = $_POST['order_id'];
481
+
482
  $email = $_POST['order_email'];
483
  if ( is_plugin_active( 'custom-order-numbers-for-woocommerce/custom-order-numbers-for-woocommerce.php' ) ) {
484
  $alg_wc_custom_order_numbers_enabled = get_option('alg_wc_custom_order_numbers_enabled');
547
  wp_reset_postdata();
548
  }
549
  }
550
+
551
+ if ( is_plugin_active( 'wp-lister/wp-lister.php' ) || is_plugin_active( 'wp-lister-for-ebay/wp-lister.php' )) {
552
+ $args = array(
553
+ 'post_type' => 'shop_order',
554
+ 'posts_per_page' => '1',
555
+ 'meta_query' => array(
556
+ 'relation' => 'AND',
557
+ array(
558
+ 'key' => '_ebay_order_id',
559
+ 'value' => $order_id
560
+ ),
561
+ ),
562
+ 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
563
+ );
564
+ $posts = get_posts( $args );
565
+ $my_query = new WP_Query( $args );
566
+
567
+ if( $my_query->have_posts() ) {
568
+ while( $my_query->have_posts()) {
569
+ $my_query->the_post();
570
+ if(get_the_ID()){
571
+ $order_id = get_the_ID();
572
+ }
573
+ } // end while
574
+ } // end if
575
+ wp_reset_postdata();
576
+ }
577
+
578
  if(!get_post_status( $order_id )){
579
  echo '';
580
  exit;
605
  foreach($tracking_items as $item){
606
  $tracking_number = $item['tracking_number'];
607
  $trackship_url = 'https://trackship.info';
608
+ $tracking_provider = $item['tracking_provider'];
609
+ $results = $wpdb->get_row( "SELECT * FROM {$this->table} WHERE ts_slug= '{$tracking_provider}'");
610
+ $tracking_provider = $results->provider_name;
611
+ /*** Update in 2.4.1
612
+ * Change URL
613
+ * Add User Key
614
+ ***/
615
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info';
616
  $args['body'] = array(
617
+ 'tracking_number' => $tracking_number,
618
+ 'order_id' => $order_id,
619
+ 'domain' => get_home_url(),
620
+ 'user_key' => $wc_ast_api_key,
621
  );
622
+
623
  $response = wp_remote_post( $url, $args );
624
 
625
  $data = $response['body'];
626
  $decoded_data = json_decode($data);
627
+
628
+ $tracker->ep_status = '';
629
+
630
+ $tracker = $decoded_data[0];
631
+
632
+ $tracking_detail_org = '';
633
+ $trackind_detail_by_status_rev = '';
634
+
635
  if(!$tracker){
636
  header("Status: 404 Not Found");
637
  exit;
661
  $unixTimestamp = strtotime($decoded_data[0]->est_delivery_date);
662
  //Get the day of the week using PHP's date function.
663
  $day = date("l", $unixTimestamp);
664
+ if($decoded_data){
665
  ?>
666
  <div class="tracking-detail col">
667
  <?php if($total_trackings > 1 ){ ?>
670
  <?php } ?>
671
  <div class="tracking-header">
672
  <div class="col-md col-md-6">
673
+ <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></span><br/>
674
+ <?php echo $tracking_provider; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
675
  <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>
676
  </div>
677
  <div class="col-md col-md-6">
688
  <?php } ?>
689
  </div>
690
  </div>
691
+ <?php
692
+ if(isset($tracker->ep_status)){ ?>
693
  <div class="status-section desktop-section">
694
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
695
  <div class="progress">
696
+ <div class="progress-bar"></div>
697
  </div>
698
  <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';} ?>">
699
+ <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>
700
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
701
  <?php
702
  if($tracker->ep_status == "unknown"){
703
  echo apply_filters("trackship_status_filter",'unknown');
707
  ?>
708
  </span>
709
 
710
+ <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>
711
+ <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'; } ?>">
712
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
713
  </span>
714
 
715
+ <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>
716
+ <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'; } ?>">
717
  <?php
718
  if($tracker->ep_status == "return_to_sender"){
719
  echo apply_filters("trackship_status_filter",'return_to_sender');
725
  ?>
726
  </span>
727
 
728
+ <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>
729
+ <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'; }?>">
730
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
731
  </span>
732
  </div>
736
  <div class="status-section mobile-section">
737
  <div class="tracker-progress-bar tracker-progress-bar-with-dots">
738
  <div class="progress">
739
+ <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>
740
  </div>
741
  <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';} ?>">
742
 
743
  <div class="dot-div">
744
+ <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>
745
+ <span class="state-label <?php if($tracker->ep_status =="pre_transit" || $tracker->ep_status =="unknown"){ echo 'current-state'; } else{ echo 'past-state';} ?>">
746
  <?php
747
  if($tracker->ep_status == "unknown"){
748
  echo apply_filters("trackship_status_filter",'unknown');
754
  </div>
755
 
756
  <div class="dot-div">
757
+ <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>
758
+ <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'; } ?>">
759
  <?php echo apply_filters("trackship_status_filter",'in_transit'); ?>
760
  </span>
761
  </div>
762
 
763
  <div class="dot-div">
764
+ <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>
765
+ <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'; } ?>">
766
  <?php
767
  if($tracker->ep_status == "return_to_sender"){
768
  echo apply_filters("trackship_status_filter",'return_to_sender');
776
  </div>
777
 
778
  <div class="dot-div">
779
+ <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>
780
+ <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'; }?>">
781
  <?php echo apply_filters("trackship_status_filter",'delivered'); ?>
782
  </span>
783
  </div>
785
  </div>
786
  </div>
787
  </div>
788
+ <?php } ?>
789
+ <?php if( !empty($trackind_detail_by_status_rev) ){ ?>
790
  <div class="shipment_progress_div">
791
+ <div class="shipment_progress_heading_div">
792
+ <h4 class="tracking-number h4-heading" style=""><?php _e( 'Tracking Details', 'woo-advanced-shipment-tracking' ); ?></h4>
 
 
793
  </div>
 
 
 
794
  <table class="tracking-table">
795
  <tbody>
796
  <?php
809
 
810
  <a class="view_table_rows" href="javaScript:void(0);"><?php _e( 'view more', 'woo-advanced-shipment-tracking' ); ?></a>
811
  <a class="hide_table_rows" href="javaScript:void(0);"><?php _e( 'view less', 'woo-advanced-shipment-tracking' ); ?></a>
812
+ <?php } ?>
813
+ </div>
814
+ <?php } ?>
815
+ </div>
816
  <?php } else{ ?>
817
  <div class="tracking-detail col">
818
  <h1 class="shipment_status_heading text-secondary text-center"><?php _e( 'Tracking&nbsp;#&nbsp;'.$tracking_number, 'woo-advanced-shipment-tracking' ); ?></h1>
888
  <div class="tracking-header">
889
  <div class="col-md col-md-6">
890
  Order: <span class="tracking-number">#4542</span><br>
891
+ USPS: <span class="tracking-number">9405511899561468285343</span>
892
  <h1 class="shipment_status_heading text-success">Delivered</h1>
893
  </div>
894
  <div class="col-md col-md-6">
990
  get_footer();
991
  exit;
992
  }
993
+ }
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,7 +1443,128 @@ 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
@@ -1455,4 +1591,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
+ if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.3', '<') ){
1480
+ global $wpdb;
1481
+ $results = $wpdb->get_row( "SELECT * FROM {$this->table} LIMIT 1");
1482
+ if(!isset($results->ts_slug)) {
1483
+ $res = $wpdb->query( sprintf( "ALTER TABLE %s ADD ts_slug text NULL DEFAULT NULL AFTER provider_name", $this->table) );
1484
+ }
1485
+ $this->update_shipping_providers();
1486
+ update_option( 'wc_advanced_shipment_tracking', '3.3');
1487
+ }
1488
+ }
1489
+ }
1490
+
1491
+ public function update_shipping_providers(){
1492
+ global $wpdb;
1493
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1494
+ $resp = wp_remote_get( $url );
1495
+ $providers = json_decode($resp['body'],true);
1496
+
1497
+ $providers_name = array();
1498
+
1499
+ $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
1500
+
1501
+ foreach ( $default_shippment_providers as $key => $val ){
1502
+ $shippment_providers[ $val->provider_name ] = $val;
1503
  }
1504
+
1505
+ foreach ( $providers as $key => $val ){
1506
+ $providers_name[ $val['provider_name'] ] = $val;
1507
+ }
1508
+
1509
+ foreach($providers as $provider){
1510
+
1511
+ $provider_name = $provider['shipping_provider'];
1512
+ $provider_url = $provider['provider_url'];
1513
+ $shipping_country = $provider['shipping_country'];
1514
+ $ts_slug = $provider['shipping_provider_slug'];
1515
+
1516
+ if(isset($shippment_providers[$provider_name])){
1517
+ $db_provider_url = $shippment_providers[$provider_name]->provider_url;
1518
+ $db_shipping_country = $shippment_providers[$provider_name]->shipping_country;
1519
+ $db_ts_slug = $shippment_providers[$provider_name]->ts_slug;
1520
+ if(($db_provider_url != $provider_url) || ($db_shipping_country != $shipping_country) || ($db_ts_slug != $ts_slug)){
1521
+ $data_array = array(
1522
+ 'ts_slug' => $ts_slug,
1523
+ 'provider_url' => $provider_url,
1524
+ 'shipping_country' => $shipping_country,
1525
+ );
1526
+ $where_array = array(
1527
+ 'provider_name' => $provider_name,
1528
+ );
1529
+ $wpdb->update( $this->table, $data_array, $where_array);
1530
+ }
1531
+ } else{
1532
+ $img_url = $provider['img_url'];
1533
+ $img_slug = sanitize_title($provider_name);
1534
+ $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1535
+
1536
+ $ch = curl_init();
1537
+
1538
+ curl_setopt($ch, CURLOPT_HEADER, 0);
1539
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1540
+ curl_setopt($ch, CURLOPT_URL, $img_url);
1541
+
1542
+ $data = curl_exec($ch);
1543
+ curl_close($ch);
1544
+
1545
+ file_put_contents($img, $data);
1546
+
1547
+
1548
+ $data_array = array(
1549
+ 'shipping_country' => sanitize_text_field($shipping_country),
1550
+ 'provider_name' => sanitize_text_field($provider_name),
1551
+ 'ts_slug' => $ts_slug,
1552
+ 'provider_url' => sanitize_text_field($provider_url),
1553
+ 'display_in_order' => 0,
1554
+ 'shipping_default' => 1,
1555
+ );
1556
+ $result = $wpdb->insert( $this->table, $data_array );
1557
+ }
1558
+ }
1559
+ foreach($default_shippment_providers as $db_provider){
1560
+ if(!is_array($providers_name[$db_provider->provider_name])){
1561
+ $where = array(
1562
+ 'provider_name' => $db_provider->provider_name,
1563
+ 'shipping_default' => 1
1564
+ );
1565
+ $wpdb->delete( $this->table, $where );
1566
+ }
1567
+ }
1568
  }
1569
  /*
1570
  * Display admin notice on plugin install or update
1591
  </div>
1592
  <?php
1593
  }
1594
+ }
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;">
@@ -188,11 +193,15 @@ class WC_Advanced_Shipment_Tracking_Actions {
188
  <option value=""><?php _e( 'Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
189
  <?php
190
  foreach($shippment_countries as $s_c){
191
- echo '<optgroup label="' . esc_attr( $WC_Countries->countries[$s_c->shipping_country] ) . '">';
 
 
 
 
 
192
  $country = $s_c->shipping_country;
193
  $shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
194
- foreach ( $shippment_providers_by_country as $providers ) {
195
- //echo '<pre>';print_r($providers);echo '</pre>';
196
  $selected = ( $default_provider == esc_attr( $providers->ts_slug ) ) ? 'selected' : '';
197
  echo '<option value="' . esc_attr( $providers->ts_slug ) . '" '.$selected. '>' . esc_html( $providers->provider_name ) . '</option>';
198
  }
@@ -215,8 +224,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 +251,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 +342,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
 
@@ -357,8 +372,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
357
  echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' . __( 'Provider:', 'woo-advanced-shipment-tracking' ) . '</label><br/><select id="tracking_provider" name="tracking_provider" class="chosen_select" style="width:100%;">';
358
  echo '<option value="">'.__( 'Select Provider', 'woo-advanced-shipment-tracking' ).'</option>';
359
  foreach($shippment_countries as $s_c){
360
-
361
- echo '<optgroup label="' . esc_attr( $WC_Countries->countries[$s_c->shipping_country] ) . '">';
 
 
 
 
362
  $country = $s_c->shipping_country;
363
  $shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
364
  foreach ( $shippment_providers_by_country as $providers ) {
@@ -406,8 +425,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 +798,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 +809,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 +893,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 +913,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 +926,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;">
193
  <option value=""><?php _e( 'Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
194
  <?php
195
  foreach($shippment_countries as $s_c){
196
+ if($s_c->shipping_country != 'Global'){
197
+ $country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
198
+ } else{
199
+ $country_name = 'Global';
200
+ }
201
+ echo '<optgroup label="' . $country_name . '">';
202
  $country = $s_c->shipping_country;
203
  $shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
204
+ foreach ( $shippment_providers_by_country as $providers ) {
 
205
  $selected = ( $default_provider == esc_attr( $providers->ts_slug ) ) ? 'selected' : '';
206
  echo '<option value="' . esc_attr( $providers->ts_slug ) . '" '.$selected. '>' . esc_html( $providers->provider_name ) . '</option>';
207
  }
224
  ) );
225
  ?>
226
  <p class="form-field change_order_to_shipped_field ">
227
+ <label for="change_order_to_shipped"><?php echo $change_order_status_label; ?></label>
228
+ <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'; }?>>
229
  </p>
230
  <p class="" style="text-align:left;">
231
  <input type="hidden" name="action" value="add_inline_tracking_number">
251
  */
252
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
253
  $formatted = $this->get_formatted_tracking_item( $order_id, $item );
254
+ //echo '<pre>';print_r($item);echo '</pre>';
255
  ?>
256
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
257
  <p class="tracking-content">
342
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
343
 
344
  $default_provider = get_option("wc_ast_default_provider" );
345
+ $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
346
+ $value = 1;
347
+ $cbvalue = '';
348
+ if($wc_ast_default_mark_shipped == 1){
349
+ $cbvalue = 1;
350
+ }
351
 
352
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
353
  if($wc_ast_status_shipped == 1){
354
+ $change_order_status_label = __( 'Change order to Shipped?', 'woo-advanced-shipment-tracking' );
355
  } else{
356
+ $change_order_status_label = __( 'Change order to Completed?', 'woo-advanced-shipment-tracking' );
357
  }
358
 
359
 
372
  echo '<p class="form-field tracking_provider_field"><label for="tracking_provider">' . __( 'Provider:', 'woo-advanced-shipment-tracking' ) . '</label><br/><select id="tracking_provider" name="tracking_provider" class="chosen_select" style="width:100%;">';
373
  echo '<option value="">'.__( 'Select Provider', 'woo-advanced-shipment-tracking' ).'</option>';
374
  foreach($shippment_countries as $s_c){
375
+ if($s_c->shipping_country != 'Global'){
376
+ $country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
377
+ } else{
378
+ $country_name = 'Global';
379
+ }
380
+ echo '<optgroup label="' . $country_name . '">';
381
  $country = $s_c->shipping_country;
382
  $shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
383
  foreach ( $shippment_providers_by_country as $providers ) {
425
  woocommerce_wp_checkbox( array(
426
  'id' => 'change_order_to_shipped',
427
  'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
428
+ 'description' => '',
429
+ 'cbvalue' => $cbvalue,
430
+ 'value' => $value,
431
  ) );
432
 
433
  echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
798
 
799
  $link_format = '';
800
 
801
+ foreach ( $this->get_providers() as $provider => $format ) {
802
+ if ( $provider === $tracking_item['tracking_provider'] ) {
803
+ $link_format = $format['provider_url'];
804
+ $formatted['formatted_tracking_provider'] = $format['provider_name'];
 
805
  break;
806
  }
807
 
809
  break;
810
  }
811
  }
812
+
813
+ $tracking_page = get_option('wc_ast_trackship_page_id');
814
+ $wc_ast_api_key = get_option('wc_ast_api_key');
815
+ $use_tracking_page = get_option('wc_ast_use_tracking_page');
816
+
817
+ if( $wc_ast_api_key && $use_tracking_page){
818
+ $order_key = $order->get_order_key();
819
+ $formatted['formatted_tracking_link'] = get_permalink( $tracking_page ).'?order_id='.$order_id.'&order_key='.$order_key;
820
+ } else {
821
+ if ( $link_format ) {
 
822
  $searchVal = array("%number%", str_replace(' ', '', "%2 $ s") );
823
  $tracking_number = str_replace(' ', '', $tracking_item['tracking_number']);
824
  $replaceVal = array( $tracking_number, urlencode( $postcode ) );
825
+ $link_format = str_replace($searchVal, $replaceVal, $link_format);
826
+
827
+ if($order->get_shipping_country() != null){
828
+ $shipping_country = $order->get_shipping_country();
829
+ } else{
830
+ $shipping_country = $order->get_billing_country();
831
+ }
832
+
833
+ if($order->get_shipping_postcode() != null){
834
+ $shipping_postal_code = $order->get_shipping_postcode();
835
+ } else{
836
+ $shipping_postal_code = $order->get_billing_postcode();
837
+ }
838
+
839
+ $country_code = array("%country_code%", str_replace(' ', '', "%2 $ s") );
840
+ $link_format = str_replace($country_code, $shipping_country, $link_format);
841
+
842
+ $postal_code = array("%postal_code%", str_replace(' ', '', "%2 $ s") );
843
+ $link_format = str_replace($postal_code, $shipping_postal_code, $link_format);
844
+
845
+ //echo '<pre>';print_r($shipping_postal_code);echo '</pre>';
846
  $formatted['formatted_tracking_link'] = $link_format;
847
  }
848
+ }
 
849
  }
850
 
851
  return $formatted;
893
  if($args['tracking_provider']){
894
  $tracking_item['tracking_provider'] = $args['tracking_provider'];
895
  }
896
+
 
 
 
 
 
897
  if($args['tracking_number']){
898
  $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
899
  }
900
  if($args['date_shipped']){
901
+ $date = str_replace("/","-",$args['date_shipped']);
902
+ $date = date_create($date);
903
+ $date = date_format($date,"d-m-Y");
904
+
905
+ $tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
906
  }
907
+
908
  if($args['status_shipped']){
909
  $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
910
  }
913
  $tracking_item['date_shipped'] = time();
914
  }
915
 
916
+ $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
 
 
 
 
917
 
918
  $tracking_items = $this->get_tracking_items( $order_id );
919
  $tracking_items[] = $tracking_item;
926
  }
927
  return $tracking_item;
928
  }
929
+
930
+ /*
931
+ * Adds a tracking item to the post_meta array from external system programatticaly
932
+ *
933
+ * @param int $order_id Order ID
934
+ * @param array $tracking_items List of tracking item
935
+ *
936
+ * @return array Tracking item
937
+ */
938
+ public function insert_tracking_item( $order_id, $args ) {
939
+ $tracking_item = array();
940
+ $tracking_provider = $args['tracking_provider'];
941
+
942
+ global $wpdb;
943
+ $woo_shippment_table_name = wc_advanced_shipment_tracking()->table;
944
+ $shippment_provider = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE provider_name='".$tracking_provider."'" );
945
+
946
+ if($args['tracking_provider']){
947
+ $tracking_item['tracking_provider'] = $shippment_provider['0']->ts_slug;
948
+ }
949
+ if($args['tracking_number']){
950
+ $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
951
+ }
952
+ if($args['date_shipped']){
953
+ $date = str_replace("/","-",$args['date_shipped']);
954
+ $date = date_create($date);
955
+ $date = date_format($date,"d-m-Y");
956
+
957
+ $tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
958
+ }
959
+
960
+ if($args['status_shipped']){
961
+ $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
962
+ }
963
+
964
+ if ( 0 == (int) $tracking_item['date_shipped'] ) {
965
+ $tracking_item['date_shipped'] = time();
966
+ }
967
+
968
+ $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
969
+
970
+ $tracking_items = $this->get_tracking_items( $order_id );
971
+ $tracking_items[] = $tracking_item;
972
+
973
+ if($tracking_item['tracking_provider']){
974
+ $this->save_tracking_items( $order_id, $tracking_items );
975
+ }
976
+
977
+ if( !empty($tracking_item['status_shipped'] )){
978
+ $order = new WC_Order( $order_id );
979
+ $order->update_status('completed');
980
+ }
981
+ return $tracking_item;
982
+ }
983
+
984
+
985
 
986
  /**
987
  * 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,41 @@ 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.3 =
122
+ * Fixed issue with TranslatePress plugin
123
+ * Fixed issue in tracking page
124
+ * Fixed issue if ts_slug field not created in database
125
+ * Added compatibility with WP-Lister for eBay
126
+ * Added hook for order number in tracking page
127
+
128
+ = 2.4.2 =
129
+ * Fixed issue in tracking page for unknown status
130
+ * Added PostNL International 3S,GLS Europe and Yun Express Tracking provider
131
+ * In tracking url added two more parameter - %country_code% and %postal_code%
132
+ * Updated code for add tracking item programatically
133
+ * Updated tracking page endpoint
134
+ * Removed Tracking URL validation for add/edit custom shiping provider and if not added tracking url than not display track button
135
+
136
+ = 2.4.1 =
137
+ * Fixed Hermes World shipping provider issue
138
+ * Fixed warnings Undefined index: Hermes Germany
139
+ * 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
140
+
141
+ = 2.4 =
142
+ * Fixed warnings in tracking page
143
+ * Fixed error from customizer if WooCommerce uninstalled
144
+ * Fixed date format issue in Bulk Upload
145
+ * Addes Sync Providers List functionality for all users
146
+ * Added Hermes World Shipping provider
147
+ * Added option for "mark as shipped" will be selected by default when adding tracking info to orders
148
+ * Added Shipment Status filter in order list panel
149
+ * Updated Delivered orderemail customizer layout and Google analytics tracking
150
+ * Updated tracking page design
151
+
152
+ = 2.3.9 =
153
+ * Added "DHL Freight" provider
154
+ * Added functionality when check connection store status if api key is not available in plugin than add it
155
+
156
  = 2.3.8 =
157
  * Fixed - Trackship connection issue when trackship setting saved
158
 
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.3
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.3';
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