Advanced Shipment Tracking for WooCommerce - Version 2.4.1

Version Description

  • Fixed Hermes World shipping provider issue
  • Fixed warnings Undefined index: Hermes Germany
  • 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
Download this release

Release Info

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

Code changes from version 2.3.8 to 2.4.1

assets/css/admin.css CHANGED
@@ -303,6 +303,11 @@ input.tab_input_1:checked + label{
303
  .ast_admin_content .form-table th.titledesc {
304
  width: 50%;
305
  }
 
 
 
 
 
306
  .woocommerce.zorem_admin_layout table.form-table th.th_80 {
307
  width: 80%;
308
  }
@@ -762,6 +767,15 @@ span.email_status_span i.enable {
762
  margin-top: 4px;
763
  display: inline-block;
764
  }
 
 
 
 
 
 
 
 
 
765
  .wcast-shipment-status-icon .icon-delivered:before{
766
  content: ' ';
767
  background-image: url(icons/delivered-v4.png);
@@ -924,6 +938,15 @@ span.email_status_span i.enable {
924
  display: inline-block;
925
  vertical-align: middle;
926
  }
 
 
 
 
 
 
 
 
 
927
 
928
  .wcast-shipment-status-icon i {
929
  font-size: 25px;
303
  .ast_admin_content .form-table th.titledesc {
304
  width: 50%;
305
  }
306
+ .woocommerce .ast_admin_content table.form-table th label .woocommerce-help-tip{
307
+ margin: -4px 0 0 5px;
308
+ position: relative;
309
+ font-size: 21px;
310
+ }
311
  .woocommerce.zorem_admin_layout table.form-table th.th_80 {
312
  width: 80%;
313
  }
767
  margin-top: 4px;
768
  display: inline-block;
769
  }
770
+ .wcast-shipment-status-icon .icon-invalid_user_key:before{
771
+ content: ' ';
772
+ background-image: url(icons/invalid-user-key-v4.png);
773
+ width: 20px;
774
+ height: 20px;
775
+ background-size: cover;
776
+ display: inline-block;
777
+ vertical-align: middle;
778
+ }
779
  .wcast-shipment-status-icon .icon-delivered:before{
780
  content: ' ';
781
  background-image: url(icons/delivered-v4.png);
938
  display: inline-block;
939
  vertical-align: middle;
940
  }
941
+ .ast-shipment-status .icon-invalid_user_key:before{
942
+ content: ' ';
943
+ background-image: url(icons/invalid-user-key-v4.png);
944
+ width: 20px;
945
+ height: 20px;
946
+ background-size: cover;
947
+ display: inline-block;
948
+ vertical-align: middle;
949
+ }
950
 
951
  .wcast-shipment-status-icon i {
952
  font-size: 25px;
assets/css/icons/invalid-user-key-v4.png ADDED
Binary file
assets/js/customizer-scripts.js CHANGED
@@ -18,6 +18,10 @@ jQuery(document).ready(function() {
18
  if(jQuery("#_customize-input-show_track_label").prop("checked") != true){
19
  jQuery('#customize-control-track_header_text').hide();
20
  }
 
 
 
 
21
 
22
  });
23
  jQuery(document).on("change", "#_customize-input-show_track_label", function(){
@@ -26,6 +30,13 @@ jQuery(document).on("change", "#_customize-input-show_track_label", function(){
26
  } else{
27
  jQuery('#customize-control-track_header_text').hide();
28
  }
 
 
 
 
 
 
 
29
  });
30
  jQuery(document).on("change", "#customize-control-woocommerce_customer_delivered_order_settings-enabled input", function(){
31
  if(jQuery(this).prop("checked") == true){
18
  if(jQuery("#_customize-input-show_track_label").prop("checked") != true){
19
  jQuery('#customize-control-track_header_text').hide();
20
  }
21
+
22
+ if(jQuery("#_customize-input-wcast_enable_delivered_ga_tracking").prop("checked") != true){
23
+ jQuery('#customize-control-wcast_delivered_analytics_link').hide();
24
+ }
25
 
26
  });
27
  jQuery(document).on("change", "#_customize-input-show_track_label", function(){
30
  } else{
31
  jQuery('#customize-control-track_header_text').hide();
32
  }
33
+ });
34
+ jQuery(document).on("change", "#_customize-input-wcast_enable_delivered_ga_tracking", function(){
35
+ if(jQuery(this).prop("checked") == true){
36
+ jQuery('#customize-control-wcast_delivered_analytics_link').show();
37
+ } else{
38
+ jQuery('#customize-control-wcast_delivered_analytics_link').hide();
39
+ }
40
  });
41
  jQuery(document).on("change", "#customize-control-woocommerce_customer_delivered_order_settings-enabled input", function(){
42
  if(jQuery(this).prop("checked") == true){
assets/js/shipping_row.js CHANGED
@@ -895,4 +895,11 @@ function showerror(element){
895
  }
896
  function hideerror(element){
897
  element.css("border","1px solid #ddd");
898
- }
 
 
 
 
 
 
 
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
+ } else{
903
+ jQuery("[for=show_in_completed] .multiple_label").text('Completed');
904
+ }
905
+ });
assets/shipment-provider-img/gls-italy.png ADDED
Binary file
assets/shipment-provider-img/{hermes.png → hermes-germany.png} RENAMED
File without changes
assets/shipment-provider-img/hermes-world.png ADDED
Binary file
includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php CHANGED
@@ -122,7 +122,7 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
122
  ) );
123
 
124
  //check_wcast_installed
125
- register_rest_route( $this->namespace, '/check_wcast_installed', array(
126
  array(
127
  'methods' => 'POST',
128
  'callback' => array( $this, 'check_wcast_installed' ),
@@ -136,6 +136,15 @@ class WC_Advanced_Shipment_Tracking_V1_REST_API_Controller extends WC_REST_Contr
136
  * check_wcast_installed
137
  */
138
  public function check_wcast_installed( $request ){
 
 
 
 
 
 
 
 
 
139
  $data = array(
140
  'status' => 'installed'
141
  );
122
  ) );
123
 
124
  //check_wcast_installed
125
+ register_rest_route( $this->namespace, '/check_wcast_installed', array(
126
  array(
127
  'methods' => 'POST',
128
  'callback' => array( $this, 'check_wcast_installed' ),
136
  * check_wcast_installed
137
  */
138
  public function check_wcast_installed( $request ){
139
+ $wc_ast_api_key = get_option('wc_ast_api_key');
140
+ $wc_ast_api_enabled = get_option('wc_ast_api_enabled');
141
+ if(empty($wc_ast_api_key)){
142
+ update_option('wc_ast_api_key',$request['user_key']);
143
+ }
144
+ if($wc_ast_api_enabled == ''){
145
+ update_option('wc_ast_api_enabled',1);
146
+ }
147
+
148
  $data = array(
149
  'status' => 'installed'
150
  );
includes/class-wc-advanced-shipment-tracking-admin.php CHANGED
@@ -113,6 +113,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
113
  // add 'get_shipment_status' order meta box order action
114
  add_action( 'woocommerce_order_actions', array( $this, 'add_order_meta_box_get_shipment_status_actions' ) );
115
  add_action( 'woocommerce_order_action_get_shipment_status_edit_order', array( $this, 'process_order_meta_box_actions_get_shipment_status' ) );
 
 
 
 
116
  }
117
 
118
  // trigger when order status changed to shipped or completed
@@ -135,12 +139,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
135
  add_filter("trackship_status_filter", array($this, "trackship_status_filter_func"), 10 , 1);
136
 
137
  // filter for shipment status icon
138
- add_filter("trackship_status_icon_filter", array($this, "trackship_status_icon_filter_func"), 10 , 2);
139
-
140
- //added wrong tracking filter
141
- add_filter( 'views_edit-shop_order', array( $this, 'filter_views_edit_shop_order'), 10, 1 );
142
- //change query for invalid tracking
143
- add_filter( 'parse_query', array( $this, 'zorem_woocommerce_admin_order_filter_query') );
144
 
145
  add_action( 'wcast_retry_trackship_apicall', array( $this, 'wcast_retry_trackship_apicall_func' ) );
146
 
@@ -168,7 +167,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
168
 
169
  add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
170
 
171
- add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun') );
172
  }
173
 
174
  /*
@@ -569,10 +568,12 @@ class WC_Advanced_Shipment_Tracking_Admin {
569
  $has_est_delivery = false;
570
  $status = $shipment_status[$key]['status'];
571
  $status_date = $shipment_status[$key]['status_date'];
572
- $est_delivery_date = $shipment_status[$key]['est_delivery_date'];
 
 
573
  if( $status != 'delivered' && $status != 'return_to_sender' && !empty($est_delivery_date) ){
574
  $has_est_delivery = true;
575
- }
576
  ?>
577
  <li id="tracking-item-<?php echo $tracking_item['tracking_id'];?>" class="tracking-item-<?php echo $tracking_item['tracking_id'];?>">
578
  <div class="wcast-shipment-status-icon">
@@ -715,7 +716,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
715
 
716
  }
717
  }
718
- wp_enqueue_script( 'shipment_tracking_table_rows' );
719
  ?>
720
  <h1 class="plugin-title"><?php _e('Advanced Shipment Tracking', 'woo-advanced-shipment-tracking'); ?></h1>
721
  <div class="wrap woocommerce zorem_admin_layout">
@@ -799,6 +800,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
799
  ?>
800
  <span class="mdl-list__item-secondary-action">
801
  <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="<?php echo $id?>">
 
802
  <input type="checkbox" id="<?php echo $id?>" name="<?php echo $id?>" class="mdl-switch__input" <?php echo $checked ?> value="1"/>
803
  </label>
804
  </span>
@@ -1054,6 +1056,12 @@ 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 +1069,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 +1084,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1069
  "show_in_refunded" =>__( 'Refunded', 'woo-advanced-shipment-tracking' ),
1070
  "show_in_processing" =>__( 'Processing', 'woo-advanced-shipment-tracking' ),
1071
  "show_in_failed" =>__( 'Failed', 'woo-advanced-shipment-tracking' ),
1072
- "show_in_completed" =>__( 'Completed', 'woo-advanced-shipment-tracking' ),
1073
  ),
1074
  'show' => true,
1075
  'class' => '',
@@ -1277,7 +1292,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 +1319,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 +1474,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 +1517,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 +1878,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" );
@@ -2050,4 +2025,118 @@ class WC_Advanced_Shipment_Tracking_Admin {
2050
  <a class="view_synch_details" id="view_deleted_details" href="javaScript:void(0);" style="display: block;"><?php _e( 'view details', 'woo-advanced-shipment-tracking'); ?></a>
2051
  <a class="view_synch_details" id="hide_deleted_details" href="javaScript:void(0);" style="display: none;"><?php _e( 'hide details', 'woo-advanced-shipment-tracking'); ?></a>
2052
  <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2053
  }
113
  // add 'get_shipment_status' order meta box order action
114
  add_action( 'woocommerce_order_actions', array( $this, 'add_order_meta_box_get_shipment_status_actions' ) );
115
  add_action( 'woocommerce_order_action_get_shipment_status_edit_order', array( $this, 'process_order_meta_box_actions_get_shipment_status' ) );
116
+
117
+ // add bulk order filter for exported / non-exported orders
118
+ add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
119
+ add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
120
  }
121
 
122
  // trigger when order status changed to shipped or completed
139
  add_filter("trackship_status_filter", array($this, "trackship_status_filter_func"), 10 , 1);
140
 
141
  // filter for shipment status icon
142
+ add_filter("trackship_status_icon_filter", array($this, "trackship_status_icon_filter_func"), 10 , 2);
 
 
 
 
 
143
 
144
  add_action( 'wcast_retry_trackship_apicall', array( $this, 'wcast_retry_trackship_apicall_func' ) );
145
 
167
 
168
  add_action( 'wp_ajax_update_shipment_status', array( $this, 'update_shipment_status_fun') );
169
 
170
+ add_action( 'wp_ajax_sync_providers', array( $this, 'sync_providers_fun') );
171
  }
172
 
173
  /*
568
  $has_est_delivery = false;
569
  $status = $shipment_status[$key]['status'];
570
  $status_date = $shipment_status[$key]['status_date'];
571
+ if(isset($shipment_status[$key]['est_delivery_date'])){
572
+ $est_delivery_date = $shipment_status[$key]['est_delivery_date'];
573
+ }
574
  if( $status != 'delivered' && $status != 'return_to_sender' && !empty($est_delivery_date) ){
575
  $has_est_delivery = true;
576
+ }
577
  ?>
578
  <li id="tracking-item-<?php echo $tracking_item['tracking_id'];?>" class="tracking-item-<?php echo $tracking_item['tracking_id'];?>">
579
  <div class="wcast-shipment-status-icon">
716
 
717
  }
718
  }
719
+ wp_enqueue_script( 'shipment_tracking_table_rows' );
720
  ?>
721
  <h1 class="plugin-title"><?php _e('Advanced Shipment Tracking', 'woo-advanced-shipment-tracking'); ?></h1>
722
  <div class="wrap woocommerce zorem_admin_layout">
800
  ?>
801
  <span class="mdl-list__item-secondary-action">
802
  <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="<?php echo $id?>">
803
+ <input type="hidden" name="<?php echo $id?>" value="0"/>
804
  <input type="checkbox" id="<?php echo $id?>" name="<?php echo $id?>" class="mdl-switch__input" <?php echo $checked ?> value="1"/>
805
  </label>
806
  </span>
1056
  } else{
1057
  $show_invoice_field = false;
1058
  }
1059
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
1060
+ if($wc_ast_status_shipped == 1){
1061
+ $completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
1062
+ } else{
1063
+ $completed_order_label = __( 'Completed', 'woo-advanced-shipment-tracking' );
1064
+ }
1065
  $form_data = array(
1066
  'wc_ast_status_shipped' => array(
1067
  'type' => 'checkbox',
1069
  'show' => true,
1070
  'class' => '',
1071
  ),
1072
+ 'wc_ast_default_mark_shipped' => array(
1073
+ 'type' => 'checkbox',
1074
+ 'title' => __( 'Default "mark as shipped" checkbox state', 'woo-advanced-shipment-tracking' ),
1075
+ 'tooltip' => __( "This means that the 'mark as shipped' will be selected by default when adding tracking info to orders.", 'woo-advanced-shipment-tracking' ),
1076
+ 'show' => true,
1077
+ 'class' => '',
1078
+ ),
1079
  'wc_ast_unclude_tracking_info' => array(
1080
  'type' => 'multiple_checkbox',
1081
  'title' => __( 'On which customer order status email to include tracking info?', 'woo-advanced-shipment-tracking' ),'options' => array(
1084
  "show_in_refunded" =>__( 'Refunded', 'woo-advanced-shipment-tracking' ),
1085
  "show_in_processing" =>__( 'Processing', 'woo-advanced-shipment-tracking' ),
1086
  "show_in_failed" =>__( 'Failed', 'woo-advanced-shipment-tracking' ),
1087
+ "show_in_completed" =>__( $completed_order_label, 'woo-advanced-shipment-tracking' ),
1088
  ),
1089
  'show' => true,
1090
  'class' => '',
1292
  $date_shipped = date("d-m-Y");
1293
  }
1294
  $replace_tracking_info = $_POST['replace_tracking_info'];
1295
+
1296
  global $wpdb;
1297
  $woo_shippment_table_name = $this->table;
1298
  $shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
1319
  if ( count( $tracking_items ) > 0 ) {
1320
  foreach ( $tracking_items as $key => $item ) {
1321
  $tracking_number = $item['tracking_number'];
1322
+ //echo '<pre>';print_r($tracking_number);echo '</pre>';exit;
1323
  if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
1324
 
1325
  } else{
1474
  case "carrier_unsupported":
1475
  $status = __( 'Carrier unsupported', 'woo-advanced-shipment-tracking' );
1476
  break;
1477
+ case "invalid_user_key":
1478
+ $status = __( 'Invalid User Key', 'woo-advanced-shipment-tracking' );
1479
+ break;
1480
+
1481
  }
1482
  return $status;
1483
  }
1517
  case "INVALID_TRACKING_NUM":
1518
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1519
  break;
1520
+ case "invalid_user_key":
1521
+ $html = '<span class="icon-'.$status.'">';
1522
+ break;
1523
  default:
1524
  $html = '<i class="fa fa-question-circle icon-'.$status.'" aria-hidden="true"></i>';
1525
  break;
1526
 
1527
  }
1528
  return $html;
1529
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1530
 
1531
  /*
1532
  * retry trackship api call
1878
  }
1879
 
1880
  public function sync_providers_fun(){
1881
+ global $wpdb;
1882
+
1883
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1884
+ $resp = wp_remote_get( $url );
 
 
 
 
 
1885
  $providers = json_decode($resp['body'],true);
1886
 
1887
  $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
2025
  <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>
2026
  <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>
2027
  <?php }
2028
+ /**
2029
+ * Add bulk filter for Shipment status in orders list
2030
+ *
2031
+ * @since 2.4
2032
+ */
2033
+ public function filter_orders_by_shipment_status(){
2034
+ global $typenow;
2035
+
2036
+ if ( 'shop_order' === $typenow ) {
2037
+
2038
+ $count = $this->get_order_count();
2039
+
2040
+ $terms = array(
2041
+ 'unknown' => (object) array( 'count' => $count['unknown'], 'term' => __( 'Unknown', 'woo-advanced-shipment-tracking' ) ),
2042
+ 'pre_transit' => (object) array( 'count' => $count['pre_transit'],'term' => __( 'Pre Transit', 'woo-advanced-shipment-tracking' ) ),
2043
+ 'in_transit' => (object) array( 'count' => $count['in_transit'],'term' => __( 'In Transit', 'woo-advanced-shipment-tracking' ) ),
2044
+ 'available_for_pickup' => (object) array( 'count' => $count['available_for_pickup'],'term' => __( 'Available for Pickup', 'woo-advanced-shipment-tracking' ) ),
2045
+ 'out_for_delivery' => (object) array( 'count' => $count['out_for_delivery'],'term' => __( 'Out for Delivery', 'woo-advanced-shipment-tracking' ) ),
2046
+ 'delivered' => (object) array( 'count' => $count['delivered'],'term' => __( 'Delivered', 'woo-advanced-shipment-tracking' ) ),
2047
+ 'failed_attempt' => (object) array( 'count' => $count['failed_attempt'],'term' => __( 'Failed Attempt', 'woo-advanced-shipment-tracking' ) ),
2048
+ 'cancelled' => (object) array( 'count' => $count['cancelled'],'term' => __( 'Cancelled', 'woo-advanced-shipment-tracking' ) ),
2049
+ 'carrier_unsupported' => (object) array( 'count' => $count['carrier_unsupported'],'term' => __( 'Carrier Unsupported', 'woo-advanced-shipment-tracking' ) ),
2050
+ 'return_to_sender' => (object) array( 'count' => $count['return_to_sender'],'term' => __( 'Return To Sender', 'woo-advanced-shipment-tracking' ) ),
2051
+ 'INVALID_TRACKING_NUM' => (object) array( 'count' => $count['invalid_tracking_number'],'term' => __( 'Invalid Tracking Number', 'woo-advanced-shipment-tracking' ) ),
2052
+ );
2053
+
2054
+ ?>
2055
+ <select name="_shop_order_shipment_status" id="dropdown_shop_order_shipment_status">
2056
+ <option value=""><?php _e( 'Filter by shipment status', 'woo-advanced-shipment-tracking' ); ?></option>
2057
+ <?php foreach ( $terms as $value => $term ) : ?>
2058
+ <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 ) : '' ); ?>>
2059
+ <?php printf( '%1$s (%2$s)', esc_html( $term->term ), esc_html( $term->count ) ); ?>
2060
+ </option>
2061
+ <?php endforeach; ?>
2062
+ </select>
2063
+ <?php
2064
+ }
2065
+ }
2066
+
2067
+ /**
2068
+ * Get the order count for orders by shipment status
2069
+ * @since 2.4
2070
+ */
2071
+ private function get_order_count() {
2072
+
2073
+ $query_args = array(
2074
+ 'fields' => 'ids',
2075
+ 'post_type' => 'shop_order',
2076
+ 'post_status' => isset( $_GET['post_status'] ) ? $_GET['post_status'] : 'any',
2077
+ 'meta_query' => array(
2078
+ array(
2079
+ 'key' => 'shipment_status',
2080
+ 'value' => '',
2081
+ 'compare' => 'LIKE',
2082
+ )
2083
+ ),
2084
+ 'nopaging' => true,
2085
+ );
2086
+
2087
+ $order_query = new WP_Query( $query_args );
2088
+
2089
+ $query_args['meta_query'][0]['value'] = 'delivered';
2090
+ $delivered_query = new WP_Query( $query_args );
2091
+
2092
+ $query_args['meta_query'][0]['value'] = 'unknown';
2093
+ $unknown_query = new WP_Query( $query_args );
2094
+
2095
+ $query_args['meta_query'][0]['value'] = 'pre_transit';
2096
+ $pre_transit_query = new WP_Query( $query_args );
2097
+
2098
+ $query_args['meta_query'][0]['value'] = 'in_transit';
2099
+ $in_transit_query = new WP_Query( $query_args );
2100
+
2101
+ $query_args['meta_query'][0]['value'] = 'available_for_pickup';
2102
+ $available_for_pickup_query = new WP_Query( $query_args );
2103
+
2104
+ $query_args['meta_query'][0]['value'] = 'out_for_delivery';
2105
+ $out_for_delivery_query = new WP_Query( $query_args );
2106
+
2107
+ $query_args['meta_query'][0]['value'] = 'failed_attempt';
2108
+ $failed_attempt_query = new WP_Query( $query_args );
2109
+
2110
+ $query_args['meta_query'][0]['value'] = 'cancelled';
2111
+ $cancelled_query = new WP_Query( $query_args );
2112
+
2113
+ $query_args['meta_query'][0]['value'] = 'carrier_unsupported';
2114
+ $carrier_unsupported_query = new WP_Query( $query_args );
2115
+
2116
+ $query_args['meta_query'][0]['value'] = 'return_to_sender';
2117
+ $return_to_sender_query = new WP_Query( $query_args );
2118
+
2119
+ $query_args['meta_query'][0]['value'] = 'INVALID_TRACKING_NUM';
2120
+ $invalid_tracking_number_query = new WP_Query( $query_args );
2121
+
2122
+ 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);
2123
+ }
2124
+ /**
2125
+ * Process bulk filter action for shipment status orders
2126
+ *
2127
+ * @since 3.0.0
2128
+ * @param array $vars query vars without filtering
2129
+ * @return array $vars query vars with (maybe) filtering
2130
+ */
2131
+ public function filter_orders_by_shipment_status_query( $vars ){
2132
+ global $typenow;
2133
+
2134
+ if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipment_status'] )) {
2135
+ $vars['meta_key'] = 'shipment_status';
2136
+ $vars['meta_value'] = $_GET['_shop_order_shipment_status'];
2137
+ $vars['meta_compare'] = 'LIKE';
2138
+ }
2139
+
2140
+ return $vars;
2141
+ }
2142
  }
includes/class-wc-advanced-shipment-tracking-api-call.php CHANGED
@@ -105,7 +105,7 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
105
 
106
  public function get_trackship_data( $order, $tracking_number, $tracking_provider ){
107
  $user_key = get_option("wc_ast_api_key");
108
- $domain = get_site_url();
109
  $order_id = $order->get_id();
110
 
111
  $url = 'https://trackship.info/wp-json/tracking/create';
105
 
106
  public function get_trackship_data( $order, $tracking_number, $tracking_provider ){
107
  $user_key = get_option("wc_ast_api_key");
108
+ $domain = get_home_url();
109
  $order_id = $order->get_id();
110
 
111
  $url = 'https://trackship.info/wp-json/tracking/create';
includes/class-wc-advanced-shipment-tracking-front.php CHANGED
@@ -226,11 +226,18 @@ class WC_Advanced_Shipment_Tracking_Front {
226
  $num = 1;
227
  $total_trackings = sizeof($tracking_items);
228
  foreach($tracking_items as $item){
 
229
  $tracking_number = $item['tracking_number'];
230
  $trackship_url = 'https://trackship.info';
231
- $url = $trackship_url.'/wp-json/wc/v1/get_tracking_info_by_number';
 
 
 
 
 
232
  $args['body'] = array(
233
- 'tracking_number' => $tracking_number
 
234
  );
235
  $response = wp_remote_post( $url, $args );
236
  $data = $response['body'];
@@ -254,12 +261,15 @@ class WC_Advanced_Shipment_Tracking_Front {
254
  $trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
255
  }
256
 
257
- $unixTimestamp = strtotime($tracker->est_delivery_date);
258
- //Get the day of the week using PHP's date function.
259
- $day = date("l", $unixTimestamp);
260
  if(!empty($tracking_detail_org)){
261
- //echo '<pre>';print_r($tracking_detail_org);echo '</pre>';
262
 
 
 
 
 
 
 
263
  if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
264
  if($tracker->ep_status == "return_to_sender" ){
265
  $state2_class = 'return_to_sender';
@@ -280,7 +290,7 @@ class WC_Advanced_Shipment_Tracking_Front {
280
  <div class="tracking-header">
281
  <div class="col-md col-md-6">
282
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
283
- <?php _e( 'Tracking: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $tracker->tracking_code; ?></span>
284
  <h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
285
  </div>
286
  <div class="col-md col-md-6">
@@ -545,7 +555,7 @@ 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
  );
@@ -594,7 +604,7 @@ class WC_Advanced_Shipment_Tracking_Front {
594
  <div class="tracking-header">
595
  <div class="col-md col-md-6">
596
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
597
- <?php _e( 'Tracking: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $tracker->tracking_code; ?></span>
598
  <h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-success'; } else{ echo 'text-secondary'; } ?>"><?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?></h1>
599
  </div>
600
  <div class="col-md col-md-6">
@@ -813,7 +823,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">
226
  $num = 1;
227
  $total_trackings = sizeof($tracking_items);
228
  foreach($tracking_items as $item){
229
+
230
  $tracking_number = $item['tracking_number'];
231
  $trackship_url = 'https://trackship.info';
232
+
233
+ /*** Update in 2.4.1
234
+ * Change URL
235
+ * Add User Key
236
+ ***/
237
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info_by_number';
238
  $args['body'] = array(
239
+ 'tracking_number' => $tracking_number,
240
+ 'user_key' => $wc_ast_api_key,
241
  );
242
  $response = wp_remote_post( $url, $args );
243
  $data = $response['body'];
261
  $trackind_detail_by_status_rev = array_reverse($trackind_detail_by_status);
262
  }
263
 
264
+
 
 
265
  if(!empty($tracking_detail_org)){
 
266
 
267
+ if($tracker->est_delivery_date){
268
+ $unixTimestamp = strtotime($tracker->est_delivery_date);
269
+ $day = date("l", $unixTimestamp);
270
+ }
271
+
272
+ //echo '<pre>';print_r($tracker->carrier);echo '</pre>';
273
  if($tracker->ep_status == "unknown"){ $state0_class = 'unknown'; } else{ $state0_class = 'pre_transit'; }
274
  if($tracker->ep_status == "return_to_sender" ){
275
  $state2_class = 'return_to_sender';
290
  <div class="tracking-header">
291
  <div class="col-md col-md-6">
292
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
293
+ <?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
294
  <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>
295
  </div>
296
  <div class="col-md col-md-6">
555
  foreach($tracking_items as $item){
556
  $tracking_number = $item['tracking_number'];
557
  $trackship_url = 'https://trackship.info';
558
+ $url = $trackship_url.'/wp-json/tracking/get_tracking_info_by_number';
559
  $args['body'] = array(
560
  'tracking_number' => $tracking_number
561
  );
604
  <div class="tracking-header">
605
  <div class="col-md col-md-6">
606
  <?php _e( 'Order: ', 'woo-advanced-shipment-tracking' ); ?><span class="tracking-number">#<?php echo $order_id; ?></span><br/>
607
+ <?php echo $tracker->carrier; ?>: <span class="tracking-number"><?php echo $tracker->tracking_code; ?></span>
608
  <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>
609
  </div>
610
  <div class="col-md col-md-6">
823
  <div class="tracking-header">
824
  <div class="col-md col-md-6">
825
  Order: <span class="tracking-number">#4542</span><br>
826
+ USPS: <span class="tracking-number">9405511899561468285343</span>
827
  <h1 class="shipment_status_heading text-success">Delivered</h1>
828
  </div>
829
  <div class="col-md col-md-6">
includes/class-wc-advanced-shipment-tracking-install.php CHANGED
@@ -127,7 +127,7 @@ class WC_Advanced_Shipment_Tracking_Install {
127
  "shipping_default" => $shipping_provider['shipping_default'],
128
  ));
129
  }
130
- update_option( 'wc_advanced_shipment_tracking', '2.9');
131
  }
132
  }
133
  /**
@@ -234,9 +234,9 @@ class WC_Advanced_Shipment_Tracking_Install {
234
  ),
235
 
236
  12 => array (
237
- "provider_name" => 'Hermes',
238
- "ts_slug" => 'hermes',
239
- "provider_url" => 'https://tracking.hermesworld.com/?TrackID=%number%',
240
  "shipping_country" => 'DE',
241
  "shipping_default" => '1'
242
  ),
@@ -914,8 +914,23 @@ class WC_Advanced_Shipment_Tracking_Install {
914
  "provider_url" => 'https://www.deppon.com/en/toTrack.action',
915
  "shipping_country" => 'CN',
916
  "shipping_default" => '1',
917
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  );
 
919
  return $providers;
920
  }
921
  /*
@@ -1428,8 +1443,117 @@ class WC_Advanced_Shipment_Tracking_Install {
1428
 
1429
  update_option( 'wc_advanced_shipment_tracking', '2.9');
1430
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1431
  }
1432
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1433
  /*
1434
  * Display admin notice on plugin install or update
1435
  */
@@ -1455,4 +1579,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
  }
1476
  }
1477
+
1478
+ public function update_shipping_providers(){
1479
+ global $wpdb;
1480
+ $url = 'https://trackship.info/wp-json/WCAST/v1/Provider';
1481
+ $resp = wp_remote_get( $url );
1482
+ $providers = json_decode($resp['body'],true);
1483
+
1484
+ $providers_name = array();
1485
+
1486
+ $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE shipping_default = 1" );
1487
+
1488
+ foreach ( $default_shippment_providers as $key => $val ){
1489
+ $shippment_providers[ $val->provider_name ] = $val;
1490
+ }
1491
+
1492
+ foreach ( $providers as $key => $val ){
1493
+ $providers_name[ $val['provider_name'] ] = $val;
1494
+ }
1495
+ //echo '<pre>';print_r($providers_name);echo '</pre>';exit;
1496
+
1497
+ foreach($providers as $provider){
1498
+
1499
+ $provider_name = $provider['shipping_provider'];
1500
+ $provider_url = $provider['provider_url'];
1501
+ $shipping_country = $provider['shipping_country'];
1502
+ $ts_slug = $provider['shipping_provider_slug'];
1503
+
1504
+ if(isset($shippment_providers[$provider_name])){
1505
+ $db_provider_url = $shippment_providers[$provider_name]->provider_url;
1506
+ $db_shipping_country = $shippment_providers[$provider_name]->shipping_country;
1507
+ $db_ts_slug = $shippment_providers[$provider_name]->ts_slug;
1508
+ if(($db_provider_url != $provider_url) || ($db_shipping_country != $shipping_country) || ($db_ts_slug != $ts_slug)){
1509
+ $data_array = array(
1510
+ 'ts_slug' => $ts_slug,
1511
+ 'provider_url' => $provider_url,
1512
+ 'shipping_country' => $shipping_country,
1513
+ );
1514
+ $where_array = array(
1515
+ 'provider_name' => $provider_name,
1516
+ );
1517
+ $wpdb->update( $this->table, $data_array, $where_array);
1518
+ }
1519
+ } else{
1520
+ $img_url = $provider['img_url'];
1521
+ $img_slug = sanitize_title($provider_name);
1522
+ $img = wc_advanced_shipment_tracking()->get_plugin_path().'/assets/shipment-provider-img/'.$img_slug.'.png';
1523
+
1524
+ $ch = curl_init();
1525
+
1526
+ curl_setopt($ch, CURLOPT_HEADER, 0);
1527
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1528
+ curl_setopt($ch, CURLOPT_URL, $img_url);
1529
+
1530
+ $data = curl_exec($ch);
1531
+ curl_close($ch);
1532
+
1533
+ file_put_contents($img, $data);
1534
+
1535
+
1536
+ $data_array = array(
1537
+ 'shipping_country' => sanitize_text_field($shipping_country),
1538
+ 'provider_name' => sanitize_text_field($provider_name),
1539
+ 'ts_slug' => $ts_slug,
1540
+ 'provider_url' => sanitize_text_field($provider_url),
1541
+ 'display_in_order' => 0,
1542
+ 'shipping_default' => 1,
1543
+ );
1544
+ $result = $wpdb->insert( $this->table, $data_array );
1545
+ }
1546
+ }
1547
+ foreach($default_shippment_providers as $db_provider){
1548
+ if(!is_array($providers_name[$db_provider->provider_name])){
1549
+ $where = array(
1550
+ 'provider_name' => $db_provider->provider_name,
1551
+ 'shipping_default' => 1
1552
+ );
1553
+ $wpdb->delete( $this->table, $where );
1554
+ }
1555
+ }
1556
+ }
1557
  /*
1558
  * Display admin notice on plugin install or update
1559
  */
1579
  </div>
1580
  <?php
1581
  }
1582
+ }
includes/class-wc-advanced-shipment-tracking.php CHANGED
@@ -57,7 +57,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
57
  if ( ! empty( $results ) ) {
58
 
59
  foreach ( $results as $row ) {
60
- $shippment_providers[ $row->provider_name ] = apply_filters( 'shipping_provider_url_template', $row->provider_url, $row->provider_name );
 
 
 
 
61
  }
62
 
63
  $this->providers = $shippment_providers;
@@ -169,13 +173,14 @@ class WC_Advanced_Shipment_Tracking_Actions {
169
 
170
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
171
 
172
- $default_provider = get_option("wc_ast_default_provider" );
 
173
 
174
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
175
  if($wc_ast_status_shipped == 1){
176
- $change_order_status_label = 'Change order to Shipped?';
177
  } else{
178
- $change_order_status_label = 'Change order to Completed?';
179
  }
180
  ?>
181
  <div id="" class="popupwrapper add_tracking_popup" style="display:none;">
@@ -215,8 +220,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
215
  ) );
216
  ?>
217
  <p class="form-field change_order_to_shipped_field ">
218
- <label for="change_order_to_shipped"><?php _e( 'Change order to Shipped?', 'woo-advanced-shipment-tracking'); ?></label>
219
- <input type="checkbox" class="checkbox" style="" name="change_order_to_shipped" id="change_order_to_shipped" value="yes">
220
  </p>
221
  <p class="" style="text-align:left;">
222
  <input type="hidden" name="action" value="add_inline_tracking_number">
@@ -242,7 +247,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
242
  */
243
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
244
  $formatted = $this->get_formatted_tracking_item( $order_id, $item );
245
- //echo '<pre>';print_r($formatted);echo '</pre>';
246
  ?>
247
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
248
  <p class="tracking-content">
@@ -333,12 +338,18 @@ class WC_Advanced_Shipment_Tracking_Actions {
333
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
334
 
335
  $default_provider = get_option("wc_ast_default_provider" );
 
 
 
 
 
 
336
 
337
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
338
  if($wc_ast_status_shipped == 1){
339
- $change_order_status_label = 'Change order to Shipped?';
340
  } else{
341
- $change_order_status_label = 'Change order to Completed?';
342
  }
343
 
344
 
@@ -406,8 +417,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
406
  woocommerce_wp_checkbox( array(
407
  'id' => 'change_order_to_shipped',
408
  'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
409
- 'description' => '',
410
- 'value' => '',
 
411
  ) );
412
 
413
  echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
@@ -777,12 +789,11 @@ class WC_Advanced_Shipment_Tracking_Actions {
777
  } else {
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
 
@@ -866,8 +877,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
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
  }
57
  if ( ! empty( $results ) ) {
58
 
59
  foreach ( $results as $row ) {
60
+ //$shippment_providers[ $row->ts_slug ] = apply_filters( 'shipping_provider_url_template', $row->provider_url, $row->ts_slug );
61
+ $shippment_providers[ $row->ts_slug ] = array(
62
+ 'provider_name'=> $row->provider_name,
63
+ 'provider_url' => $row->provider_url,
64
+ );
65
  }
66
 
67
  $this->providers = $shippment_providers;
173
 
174
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
175
 
176
+ $default_provider = get_option("wc_ast_default_provider" );
177
+ $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
178
 
179
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
180
  if($wc_ast_status_shipped == 1){
181
+ $change_order_status_label = __( 'Change order to Shipped?', 'woo-advanced-shipment-tracking' );
182
  } else{
183
+ $change_order_status_label = __( 'Change order to Completed?', 'woo-advanced-shipment-tracking' );
184
  }
185
  ?>
186
  <div id="" class="popupwrapper add_tracking_popup" style="display:none;">
220
  ) );
221
  ?>
222
  <p class="form-field change_order_to_shipped_field ">
223
+ <label for="change_order_to_shipped"><?php echo $change_order_status_label; ?></label>
224
+ <input type="checkbox" class="checkbox" style="" name="change_order_to_shipped" id="change_order_to_shipped" value="yes" <?php if($wc_ast_default_mark_shipped == 1){ echo 'checked'; }?>>
225
  </p>
226
  <p class="" style="text-align:left;">
227
  <input type="hidden" name="action" value="add_inline_tracking_number">
247
  */
248
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
249
  $formatted = $this->get_formatted_tracking_item( $order_id, $item );
250
+ //echo '<pre>';print_r($item);echo '</pre>';
251
  ?>
252
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
253
  <p class="tracking-content">
338
  $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
339
 
340
  $default_provider = get_option("wc_ast_default_provider" );
341
+ $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
342
+ $value = 1;
343
+ $cbvalue = '';
344
+ if($wc_ast_default_mark_shipped == 1){
345
+ $cbvalue = 1;
346
+ }
347
 
348
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
349
  if($wc_ast_status_shipped == 1){
350
+ $change_order_status_label = __( 'Change order to Shipped?', 'woo-advanced-shipment-tracking' );
351
  } else{
352
+ $change_order_status_label = __( 'Change order to Completed?', 'woo-advanced-shipment-tracking' );
353
  }
354
 
355
 
417
  woocommerce_wp_checkbox( array(
418
  'id' => 'change_order_to_shipped',
419
  'label' => __( $change_order_status_label, 'woo-advanced-shipment-tracking' ),
420
+ 'description' => '',
421
+ 'cbvalue' => $cbvalue,
422
+ 'value' => $value,
423
  ) );
424
 
425
  echo '<button class="button button-primary button-save-form">' . __( 'Save Tracking', 'woo-advanced-shipment-tracking' ) . '</button>';
789
  } else {
790
 
791
  $link_format = '';
792
+ //echo '<pre>';print_r($this->get_providers());echo '</pre>';
793
+ foreach ( $this->get_providers() as $provider => $format ) {
794
+ if ( $provider === $tracking_item['tracking_provider'] ) {
795
+ $link_format = $format['provider_url'];
796
+ $formatted['formatted_tracking_provider'] = $format['provider_name'];
 
797
  break;
798
  }
799
 
877
  $tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
878
  }
879
  if($args['date_shipped']){
880
+ $date = str_replace("/","-",$args['date_shipped']);
881
+ $date = date_create($date);
882
+ $date = date_format($date,"d-m-Y");
883
+
884
+ $tracking_item['date_shipped'] = wc_clean( strtotime( $date ) );
885
  }
886
+
887
  if($args['status_shipped']){
888
  $tracking_item['status_shipped'] = wc_clean( $args['status_shipped'] );
889
  }
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,26 @@ 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.1 =
122
+ * Fixed Hermes World shipping provider issue
123
+ * Fixed warnings Undefined index: Hermes Germany
124
+ * 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
125
+
126
+ = 2.4 =
127
+ * Fixed warnings in tracking page
128
+ * Fixed error from customizer if WooCommerce uninstalled
129
+ * Fixed date format issue in Bulk Upload
130
+ * Addes Sync Providers List functionality for all users
131
+ * Added Hermes World Shipping provider
132
+ * Added option for "mark as shipped" will be selected by default when adding tracking info to orders
133
+ * Added Shipment Status filter in order list panel
134
+ * Updated Delivered orderemail customizer layout and Google analytics tracking
135
+ * Updated tracking page design
136
+
137
+ = 2.3.9 =
138
+ * Added "DHL Freight" provider
139
+ * Added functionality when check connection store status if api key is not available in plugin than add it
140
+
141
  = 2.3.8 =
142
  * Fixed - Trackship connection issue when trackship setting saved
143
 
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' ) );
@@ -324,9 +326,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
324
  public function on_plugins_loaded() {
325
  require_once $this->get_plugin_path() . '/includes/customizer/class-wcast-customizer.php';
326
 
327
- require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
328
-
329
- //require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-page-customizer.php';
330
 
331
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
332
 
4
  * Plugin Name: Advanced Shipment Tracking for WooCommerce
5
  * Plugin URI:
6
  * Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
7
+ * Version: 2.4.1
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.1';
26
 
27
  /**
28
  * Initialize the main plugin function
51
  $this->table = $wpdb->prefix."woo_shippment_provider";
52
  }
53
 
54
+
55
 
56
  if ( $this->is_wc_active() ) {
57
  // Include required files.
68
 
69
  //plugin install class init
70
  $this->install->init();
71
+
72
+ add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
73
  }
74
  add_action( 'admin_footer', array( $this, 'uninstall_notice') );
75
  //register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
326
  public function on_plugins_loaded() {
327
  require_once $this->get_plugin_path() . '/includes/customizer/class-wcast-customizer.php';
328
 
329
+ require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
 
 
330
 
331
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
332