Advanced Shipment Tracking for WooCommerce - Version 2.9.9.5

Version Description

  • Enhancement - Update TrackShip link on WordPress dashboard and on the AST settings page
  • Fix - Responsive issue of the shipping provider list
  • Enhancement - Added shipping providers filter dropdown in the orders page
  • Fix - Fixed warning - Undefined variable: trackship_supported in plugins/woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php on line 1056
  • Dev - Remove query SHOW TABLES LIKE 'wp\_shipment\_batch\_process'
  • Dev - Added compatibility with Yith custom order numbers plugin
  • Enhancement - Added option for remove tracking info from Customer note emails
Download this release

Release Info

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

Code changes from version 2.9.9.3 to 2.9.9.5

assets/css/admin.css CHANGED
@@ -303,7 +303,7 @@ input.tab_input_1:checked + label{
303
  .ast_admin_content .form-table .wp-color-result.button {
304
  margin: 0 6px 0px 0;
305
  }
306
- #wc_ast_status_label_color,#wc_ast_status_partial_shipped_label_color,#wc_ast_status_updated_tracking_label_color,#wc_ast_select_primary_color,#wc_ast_select_border_color {
307
  width: 80px;
308
  }
309
  .color_field input[type=text] {
@@ -1424,7 +1424,7 @@ p.delivered_message {
1424
  border: 0;
1425
  background: #fafeff;
1426
  }
1427
- #wc_ast_settings_form table.form-table.heading-table tr,#wc_ast_trackship_form table.form-table.heading-table tr,#wc_ast_upload_csv_form table.form-table.heading-table tr{
1428
  border-bottom: 0;
1429
  }
1430
  .woocommerce.zorem_admin_layout table.form-table.heading-table td{
@@ -1459,6 +1459,9 @@ p.delivered_message {
1459
  .woocommerce.zorem_admin_layout table.form-table.table-layout-2 th.titledesc{
1460
  padding: 20px 15px 20px 15px;
1461
  }
 
 
 
1462
  .woocommerce.zorem_admin_layout table.form-table td{
1463
  padding: 15px 15px;
1464
  }
@@ -1947,10 +1950,6 @@ span.tracking_product_list {
1947
  .order-status-table tr td.status-label-column{
1948
  width:130px;
1949
  }
1950
- .form-table .multiple_checkbox {
1951
- display: inline-block;
1952
- padding-right: 20px;
1953
- }
1954
  .order-status-table .wp-picker-container,.tracking_page_table .wp-picker-container {
1955
  display: inline-block;
1956
  vertical-align: middle;
@@ -2159,6 +2158,9 @@ table.form-table.heading-table.disable_tracking_page {
2159
  .right-div{
2160
  width: 60%;
2161
  }
 
 
 
2162
  }
2163
  @media screen and (max-width: 820px) {
2164
  .nav_doc_section{
@@ -2213,4 +2215,9 @@ table.form-table.heading-table.disable_tracking_page {
2213
  .plugin-logo{
2214
  max-width: 300px;
2215
  }
 
 
 
 
 
2216
  }
303
  .ast_admin_content .form-table .wp-color-result.button {
304
  margin: 0 6px 0px 0;
305
  }
306
+ #wc_ast_status_label_color,#wc_ast_status_partial_shipped_label_color,#wc_ast_status_updated_tracking_label_color,#wc_ast_select_primary_color,#wc_ast_select_border_color,#wc_ast_shipped_status_label_color {
307
  width: 80px;
308
  }
309
  .color_field input[type=text] {
1424
  border: 0;
1425
  background: #fafeff;
1426
  }
1427
+ #wc_ast_trackship_form table.form-table.heading-table tr,#wc_ast_upload_csv_form table.form-table.heading-table tr{
1428
  border-bottom: 0;
1429
  }
1430
  .woocommerce.zorem_admin_layout table.form-table.heading-table td{
1459
  .woocommerce.zorem_admin_layout table.form-table.table-layout-2 th.titledesc{
1460
  padding: 20px 15px 20px 15px;
1461
  }
1462
+ .woocommerce.zorem_admin_layout table.form-table.table-single-column td fieldset{
1463
+ margin-top: 10px;
1464
+ }
1465
  .woocommerce.zorem_admin_layout table.form-table td{
1466
  padding: 15px 15px;
1467
  }
1950
  .order-status-table tr td.status-label-column{
1951
  width:130px;
1952
  }
 
 
 
 
1953
  .order-status-table .wp-picker-container,.tracking_page_table .wp-picker-container {
1954
  display: inline-block;
1955
  vertical-align: middle;
2158
  .right-div{
2159
  width: 60%;
2160
  }
2161
+ span.provider_name {
2162
+ font-size: 12px;
2163
+ }
2164
  }
2165
  @media screen and (max-width: 820px) {
2166
  .nav_doc_section{
2215
  .plugin-logo{
2216
  max-width: 300px;
2217
  }
2218
+ }
2219
+ @media screen and (min-width: 768px) and (max-width: 1050px) {
2220
+ .provider{
2221
+ width: 33.3%;
2222
+ }
2223
  }
assets/css/customizer-styles.css CHANGED
@@ -59,6 +59,15 @@
59
  display: inline-block;
60
  vertical-align: middle;
61
  }
 
 
 
 
 
 
 
 
 
62
  #accordion-section-customer_failure_email>h3:before{
63
  content: ' ';
64
  background-image: url(icons/failure-v4.png);
59
  display: inline-block;
60
  vertical-align: middle;
61
  }
62
+ #accordion-section-customer_shipped_email>h3:before{
63
+ content: ' ';
64
+ background-image: url(icons/shipped-o.png);
65
+ width: 20px;
66
+ height: 20px;
67
+ background-size: cover;
68
+ display: inline-block;
69
+ vertical-align: middle;
70
+ }
71
  #accordion-section-customer_failure_email>h3:before{
72
  content: ' ';
73
  background-image: url(icons/failure-v4.png);
assets/css/icons/shipped-o.png ADDED
Binary file
assets/js/admin.js CHANGED
@@ -12,9 +12,9 @@ jQuery( function( $ ) {
12
 
13
  // When a user enters a new tracking item
14
  save_form: function () {
15
- var error;
16
  var tracking_number = jQuery("#tracking_number");
17
- var tracking_provider = jQuery("#tracking_provider");
18
 
19
  if( tracking_number.val() === '' ){
20
  showerror( tracking_number );error = true;
@@ -35,16 +35,17 @@ jQuery( function( $ ) {
35
  hideerror(tracking_provider);
36
  }
37
 
38
-
39
- if(jQuery("tr").hasClass("ASTProduct_row")){
40
- var qty = false;
41
- jQuery(".ASTProduct_row").each(function(index){
42
- var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
43
- if(ASTProduct_qty > 0){
44
- qty = true;
45
- return false;
46
- }
47
- });
 
48
  }
49
 
50
  if(qty == false){
@@ -127,7 +128,6 @@ jQuery( function( $ ) {
127
  $( 'input#tracking_number' ).val( '' );
128
  $( 'input#date_shipped' ).val( '' );
129
  if(checked == 'change_order_to_shipped'){
130
- jQuery('#order_status').val('wc-completed');
131
  jQuery('#order_status').select2().trigger('change');
132
  jQuery('#post').before('<div id="order_updated_message" class="updated notice notice-success is-dismissible"><p>Order updated.</p><button type="button" class="notice-dismiss update-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>');
133
  } else if(checked == 'change_order_to_partial_shipped'){
@@ -148,6 +148,7 @@ jQuery( function( $ ) {
148
  show_form: function () {
149
  $( '#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form' ).show();
150
  $( '#woocommerce-advanced-shipment-tracking .button-show-tracking-form' ).hide();
 
151
  },
152
 
153
  // Delete a tracking item
@@ -298,8 +299,14 @@ jQuery(document).on("click", ".add_inline_tracking", function(){
298
  type: 'POST',
299
  success: function(response) {
300
  jQuery( ".add_tracking_popup" ).remove();
301
- jQuery("body").append(response);
302
  jQuery('.add_tracking_popup').show();
 
 
 
 
 
 
303
  var selected_provider = jQuery("#tracking_provider").val();
304
 
305
  if(selected_provider == 'nz-couriers' || selected_provider == 'post-haste' || selected_provider == 'castle-parcels' || selected_provider == 'dx-mail' || selected_provider == 'now-couriers'){
@@ -337,11 +344,12 @@ jQuery(document).on("submit", "#add_tracking_number_form", function(){
337
 
338
 
339
  if( tracking_provider.val() === '' ){
340
- showerror(tracking_provider);
341
  error = true;
342
- } else{
 
343
  hideerror(tracking_provider);
344
- }
345
 
346
  if( tracking_number.val() === '' ){
347
  showerror(tracking_number);
@@ -364,15 +372,17 @@ jQuery(document).on("submit", "#add_tracking_number_form", function(){
364
  }
365
 
366
 
367
- if(jQuery("tr").hasClass("ASTProduct_row")){
368
- var qty = false;
369
- jQuery(".ASTProduct_row").each(function(index){
370
- var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
371
- if(ASTProduct_qty > 0){
372
- qty = true;
373
- return false;
374
- }
375
- });
 
 
376
  }
377
 
378
  if(qty == false){
12
 
13
  // When a user enters a new tracking item
14
  save_form: function () {
15
+ var error;
16
  var tracking_number = jQuery("#tracking_number");
17
+ var tracking_provider = jQuery("#tracking_provider");
18
 
19
  if( tracking_number.val() === '' ){
20
  showerror( tracking_number );error = true;
35
  hideerror(tracking_provider);
36
  }
37
 
38
+ if(jQuery('.enable_tracking_per_item').prop("checked") == true){
39
+ if(jQuery("tr").hasClass("ASTProduct_row")){
40
+ var qty = false;
41
+ jQuery(".ASTProduct_row").each(function(index){
42
+ var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
43
+ if(ASTProduct_qty > 0){
44
+ qty = true;
45
+ return false;
46
+ }
47
+ });
48
+ }
49
  }
50
 
51
  if(qty == false){
128
  $( 'input#tracking_number' ).val( '' );
129
  $( 'input#date_shipped' ).val( '' );
130
  if(checked == 'change_order_to_shipped'){
 
131
  jQuery('#order_status').select2().trigger('change');
132
  jQuery('#post').before('<div id="order_updated_message" class="updated notice notice-success is-dismissible"><p>Order updated.</p><button type="button" class="notice-dismiss update-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>');
133
  } else if(checked == 'change_order_to_partial_shipped'){
148
  show_form: function () {
149
  $( '#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form' ).show();
150
  $( '#woocommerce-advanced-shipment-tracking .button-show-tracking-form' ).hide();
151
+ $( "#woocommerce-advanced-shipment-tracking #advanced-shipment-tracking-form #tracking_number" ).focus();
152
  },
153
 
154
  // Delete a tracking item
299
  type: 'POST',
300
  success: function(response) {
301
  jQuery( ".add_tracking_popup" ).remove();
302
+ jQuery("body").append(response);
303
  jQuery('.add_tracking_popup').show();
304
+ jQuery( "#add_tracking_number_form #tracking_number" ).focus();
305
+
306
+ jQuery('#tracking_provider').select2({
307
+ matcher: modelMatcher
308
+ });
309
+
310
  var selected_provider = jQuery("#tracking_provider").val();
311
 
312
  if(selected_provider == 'nz-couriers' || selected_provider == 'post-haste' || selected_provider == 'castle-parcels' || selected_provider == 'dx-mail' || selected_provider == 'now-couriers'){
344
 
345
 
346
  if( tracking_provider.val() === '' ){
347
+ jQuery("#tracking_provider").siblings('.select2-container').find('.select2-selection').css('border-color','red');
348
  error = true;
349
+ } else{
350
+ jQuery("#tracking_provider").siblings('.select2-container').find('.select2-selection').css('border-color','#ddd');
351
  hideerror(tracking_provider);
352
+ }
353
 
354
  if( tracking_number.val() === '' ){
355
  showerror(tracking_number);
372
  }
373
 
374
 
375
+ if(jQuery('.enable_tracking_per_item').prop("checked") == true){
376
+ if(jQuery("tr").hasClass("ASTProduct_row")){
377
+ var qty = false;
378
+ jQuery(".ASTProduct_row").each(function(index){
379
+ var ASTProduct_qty = jQuery(this).find('input[type="number"]').val();
380
+ if(ASTProduct_qty > 0){
381
+ qty = true;
382
+ return false;
383
+ }
384
+ });
385
+ }
386
  }
387
 
388
  if(qty == false){
assets/js/customizer-scripts.js CHANGED
@@ -7,7 +7,7 @@ jQuery(document).ready(function() {
7
 
8
  /**
9
  * Change description
10
- */
11
  jQuery(wcast_customizer.trigger_click).trigger( "click" );
12
  jQuery('#customize-theme-controls #accordion-section-themes').hide();
13
 
@@ -331,6 +331,30 @@ jQuery(document).on("change", "#_customize-input-customizer_delivered_order_sett
331
  } );
332
  } );
333
  } ( wp.customize ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  (function ( api ) {
336
  api.section( 'customer_updated_tracking_email', function( section ) {
7
 
8
  /**
9
  * Change description
10
+ */
11
  jQuery(wcast_customizer.trigger_click).trigger( "click" );
12
  jQuery('#customize-theme-controls #accordion-section-themes').hide();
13
 
331
  } );
332
  } );
333
  } ( wp.customize ) );
334
+ (function ( api ) {
335
+ api.section( 'customer_custom_completed_email', function( section ) {
336
+ section.expanded.bind( function( isExpanded ) {
337
+ var url;
338
+ if ( isExpanded ) {
339
+ jQuery('#save').trigger('click');
340
+ url = wcast_customizer.custom_completed_email_preview_url;
341
+ api.previewer.previewUrl.set( url );
342
+ }
343
+ } );
344
+ } );
345
+ } ( wp.customize ) );
346
+ (function ( api ) {
347
+ api.section( 'customer_shipped_email', function( section ) {
348
+ section.expanded.bind( function( isExpanded ) {
349
+ var url;
350
+ if ( isExpanded ) {
351
+ jQuery('#save').trigger('click');
352
+ url = wcast_customizer.shipped_email_preview_url;
353
+ api.previewer.previewUrl.set( url );
354
+ }
355
+ } );
356
+ } );
357
+ } ( wp.customize ) );
358
 
359
  (function ( api ) {
360
  api.section( 'customer_updated_tracking_email', function( section ) {
assets/js/preview-scripts.js CHANGED
@@ -397,4 +397,19 @@
397
  $( '.tracking_list_div' ).css( 'border-bottom','1px solid '+provider_border_color );
398
  } );
399
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  } )( jQuery );
397
  $( '.tracking_list_div' ).css( 'border-bottom','1px solid '+provider_border_color );
398
  } );
399
  } );
400
+
401
+ wp.customize( 'woocommerce_wc_customer_custom_completed_order_settings[heading]', function( value ) {
402
+ value.bind( function( wcast_custom_completed_email_heading ) {
403
+
404
+ var str = wcast_custom_completed_email_heading;
405
+ var res = str.replace("{site_title}", wcast_preview.site_title);
406
+ var res = res.replace("{order_number}", wcast_preview.order_number);
407
+
408
+ if( wcast_custom_completed_email_heading ){
409
+ $( '#header_wrapper h1' ).text(res);
410
+ } else{
411
+ $( '#header_wrapper h1' ).text('');
412
+ }
413
+ });
414
+ });
415
  } )( jQuery );
assets/js/settings.js CHANGED
@@ -6,6 +6,14 @@ jQuery(document).on("click", "#wc_ast_status_delivered", function(){
6
  }
7
  });
8
 
 
 
 
 
 
 
 
 
9
  jQuery(document).on("click", "#wc_ast_status_partial_shipped", function(){
10
  if(jQuery(this).prop("checked") == true){
11
  jQuery(this).closest('tr').removeClass('disable_row');
@@ -42,6 +50,12 @@ jQuery( document ).ready(function() {
42
  jQuery('.order-status-table .order-label.wc-delivered').css('background',color);
43
  },
44
  });
 
 
 
 
 
 
45
  jQuery('#wc_ast_status_partial_shipped_label_color').wpColorPicker({
46
  change: function(e, ui) {
47
  var color = ui.color.toString();
@@ -82,6 +96,10 @@ jQuery(document).on("change", "#wc_ast_status_label_font_color", function(){
82
  var font_color = jQuery(this).val();
83
  jQuery('.order-status-table .order-label.wc-delivered').css('color',font_color);
84
  });
 
 
 
 
85
  jQuery(document).on("change", "#wc_ast_status_partial_shipped_label_font_color", function(){
86
  var font_color = jQuery(this).val();
87
  jQuery('.order-status-table .order-label.wc-partially-shipped').css('color',font_color);
6
  }
7
  });
8
 
9
+ jQuery(document).on("click", "#wc_ast_status_shipped_active", function(){
10
+ if(jQuery(this).prop("checked") == true){
11
+ jQuery(this).closest('tr').removeClass('disable_row');
12
+ } else{
13
+ jQuery(this).closest('tr').addClass('disable_row');
14
+ }
15
+ });
16
+
17
  jQuery(document).on("click", "#wc_ast_status_partial_shipped", function(){
18
  if(jQuery(this).prop("checked") == true){
19
  jQuery(this).closest('tr').removeClass('disable_row');
50
  jQuery('.order-status-table .order-label.wc-delivered').css('background',color);
51
  },
52
  });
53
+ jQuery('#wc_ast_shipped_status_label_color').wpColorPicker({
54
+ change: function(e, ui) {
55
+ var color = ui.color.toString();
56
+ jQuery('.order-status-table .order-label.wc-shipped').css('background',color);
57
+ },
58
+ });
59
  jQuery('#wc_ast_status_partial_shipped_label_color').wpColorPicker({
60
  change: function(e, ui) {
61
  var color = ui.color.toString();
96
  var font_color = jQuery(this).val();
97
  jQuery('.order-status-table .order-label.wc-delivered').css('color',font_color);
98
  });
99
+ jQuery(document).on("change", "#wc_ast_shipped_status_label_font_color", function(){
100
+ var font_color = jQuery(this).val();
101
+ jQuery('.order-status-table .order-label.wc-shipped').css('color',font_color);
102
+ });
103
  jQuery(document).on("change", "#wc_ast_status_partial_shipped_label_font_color", function(){
104
  var font_color = jQuery(this).val();
105
  jQuery('.order-status-table .order-label.wc-partially-shipped').css('color',font_color);
assets/js/shipping_row.js CHANGED
@@ -18,12 +18,11 @@
18
  },
19
 
20
  save_wc_ast_settings_form: function( event ) {
21
- event.preventDefault();
22
-
23
  $wc_ast_settings_form.find(".spinner").addClass("active");
24
  var ajax_data = $wc_ast_settings_form.serialize();
25
 
26
- $.post( ajaxurl, ajax_data, function(response) {
27
  $wc_ast_settings_form.find(".spinner").removeClass("active");
28
  var snackbarContainer = document.querySelector('#demo-toast-example');
29
  var data = {message: shipment_tracking_table_rows.i18n.data_saved };
@@ -1177,5 +1176,4 @@ var getUrlParameter = function getUrlParameter(sParam) {
1177
  return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
1178
  }
1179
  }
1180
- };
1181
-
18
  },
19
 
20
  save_wc_ast_settings_form: function( event ) {
21
+ event.preventDefault();
 
22
  $wc_ast_settings_form.find(".spinner").addClass("active");
23
  var ajax_data = $wc_ast_settings_form.serialize();
24
 
25
+ $.post( ajaxurl, ajax_data, function(response) {
26
  $wc_ast_settings_form.find(".spinner").removeClass("active");
27
  var snackbarContainer = document.querySelector('#demo-toast-example');
28
  var data = {message: shipment_tracking_table_rows.i18n.data_saved };
1176
  return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
1177
  }
1178
  }
1179
+ };
 
assets/shipment-provider-img/gls.png ADDED
Binary file
includes/class-wc-advanced-shipment-tracking-admin.php CHANGED
@@ -62,11 +62,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
62
  /*
63
  * init from parent mail class
64
  */
65
- public function init(){
66
-
67
- //database check
68
- add_action( 'init', array( $this, 'database_table_check') );
69
-
70
  //cron_schedules
71
  add_filter( 'cron_schedules', array( $this, 'add_cron_interval') );
72
 
@@ -101,12 +97,16 @@ class WC_Advanced_Shipment_Tracking_Admin {
101
 
102
  // add bulk order filter for exported / non-exported orders
103
  add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
104
- add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
105
-
106
- // add bulk order tracking number filter for exported / non-exported orders
107
- add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'filter_orders_by_tracking_number_query' ) );
108
  }
109
 
 
 
 
 
 
 
 
110
  // trigger when order status changed to shipped or completed
111
  add_action( 'woocommerce_order_status_completed', array( $this, 'trigger_woocommerce_order_status_completed'), 10, 1 );
112
 
@@ -160,28 +160,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
160
  if ( is_plugin_active( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' ) ) {
161
  if( !$this->licence_valid() )add_action( 'admin_notices', array( $this, 'ast_product_licence_notice') );
162
  }
163
- }
164
-
165
- /*
166
- * database table check
167
- */
168
- function database_table_check(){
169
- global $wpdb;
170
- $table_name = $wpdb->prefix.'shipment_batch_process';
171
- $charset_collate = $wpdb->get_charset_collate();
172
-
173
- $sql = "CREATE TABLE `{$table_name}` (
174
- id int NOT NULL AUTO_INCREMENT,
175
- order_id text NULL,
176
- PRIMARY KEY (id)
177
- ) $charset_collate;";
178
-
179
- if ( !function_exists( 'maybe_create_table' ) ) {
180
- require_once ABSPATH . '/wp-admin/includes/upgrade.php';
181
- }
182
- maybe_create_table( $table_name, $sql );
183
- }
184
-
185
 
186
  /*
187
  * add_cron_interval
@@ -227,7 +206,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
227
  $range = get_option('wc_ast_api_date_range', 30 );
228
  $args = array(
229
  'status' => 'wc-completed',
230
- 'limit' => 100,
231
  );
232
  if( $range != 0 ){
233
  $start = strtotime( date( 'Y-m-d 00:00:00', strtotime( '-'.$range.' days' ) ));
@@ -236,29 +215,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
236
  }
237
 
238
  return $orders = wc_get_orders( $args );
239
- }
240
-
241
- /*
242
- * add in batch process
243
- */
244
- function add_in_batch_process( $order_id ){
245
- global $wpdb;
246
- $table_name = $wpdb->prefix.'shipment_batch_process';
247
- $data = array(
248
- 'order_id' => $order_id
249
- );
250
- $wpdb->insert( $table_name, $data );
251
- return $wpdb->insert_id;
252
- }
253
-
254
- /*
255
- * remove from batch process
256
- */
257
- function remove_from_batch_process( $batch_process_id ){
258
- global $wpdb;
259
- $table_name = $wpdb->prefix.'shipment_batch_process';
260
- $wpdb->delete( $table_name, array( 'id' => $batch_process_id ) );
261
- }
262
 
263
  /*
264
  * shipment api call
@@ -634,9 +591,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
634
  }?>
635
  <span class=" multiple_checkbox">
636
  <label class="" for="<?php echo $key?>">
637
- <span class="multiple_label"><?php echo $val['status']; ?></span>
638
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
639
  <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
 
640
  </br>
641
  </label>
642
  </span>
@@ -659,9 +616,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
659
  <?php } ?>
660
  <span class="multiple_checkbox">
661
  <label class="" for="<?php echo $key?>">
662
- <span class="multiple_label"><?php echo $val['status']; ?></span>
663
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
664
- <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
 
665
  </br>
666
  </label>
667
  </span>
@@ -746,9 +703,21 @@ class WC_Advanced_Shipment_Tracking_Admin {
746
  <?php } ?>
747
  </select>
748
  </fieldset>
749
- <?php } elseif( $array['type'] == 'title' ){?>
750
- <?php }
751
- elseif( $array['type'] == 'key_field' ){ ?>
 
 
 
 
 
 
 
 
 
 
 
 
752
  <fieldset>
753
  <?php if($array['connected'] == true){ ?>
754
  <a href="https://my.trackship.info/" target="_blank">
@@ -787,8 +756,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
787
  </tbody>
788
  </table>
789
  <?php
790
- }
791
-
792
 
793
  /*
794
  * get html of fields
@@ -1063,14 +1031,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
1063
  $form_data = array(
1064
  'wc_ast_api_enabled' => array(
1065
  'type' => 'checkbox',
1066
- 'title' => __( 'Enable/Disable', 'woo-advanced-shipment-tracking' ),
1067
  'show' => $show_trackship_field,
1068
  'class' => '',
1069
  ),
1070
  'wc_ast_status_change_to_delivered' => array(
1071
  'type' => 'checkbox',
1072
- 'title' => __( 'Set order status Delivered when order is delivered', 'woo-advanced-shipment-tracking' ),
1073
- 'show' => $show_trackship_field,
1074
  'class' => '',
1075
  'disabled' => $disabled_change_to_delivered,
1076
  ),
@@ -1260,7 +1227,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1260
  */
1261
  function get_settings_data(){
1262
 
1263
- $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
1264
  if($wc_ast_status_shipped == 1){
1265
  $completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
1266
  $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>"', 'woo-advanced-shipment-tracking' );
@@ -1278,11 +1245,12 @@ class WC_Advanced_Shipment_Tracking_Admin {
1278
  'wc-processing' => 'Processing',
1279
  'wc-on-hold' => 'On hold',
1280
  'wc-completed' => 'Completed',
1281
- 'wc-delivered' => 'Delivered',
1282
- //'wc-partial-shipped' => 'Partially Shipped',
1283
  'wc-cancelled' => 'Cancelled',
1284
  'wc-refunded' => 'Refunded',
1285
- 'wc-failed' => 'Failed'
 
 
1286
  );
1287
  foreach($default_order_status as $key=>$value){
1288
  unset($all_order_status[$key]);
@@ -1305,7 +1273,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1305
  "show_in_customer_invoice" => array(
1306
  'status' => __( 'Customer Invoice', 'woocommerce' ),
1307
  'type' => 'default',
1308
- ),
1309
  "refunded" => array(
1310
  'status' => __( 'Refunded', 'woocommerce' ),
1311
  'type' => 'default',
@@ -1321,17 +1289,21 @@ class WC_Advanced_Shipment_Tracking_Admin {
1321
  "completed" => array(
1322
  'status' => $completed_order_label,
1323
  'type' => 'default',
 
 
 
 
1324
  ),
1325
  );
1326
- $order_status_array = array_merge($order_status,$custom_order_status);
1327
-
1328
  if ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) {
1329
  $show_invoice_field = true;
1330
  } else{
1331
  $show_invoice_field = false;
1332
- }
1333
 
1334
- $form_data = array(
1335
  'wc_ast_status_shipped' => array(
1336
  'type' => 'checkbox',
1337
  'title' => __( 'Rename the “Completed” Order status to “Shipped”', 'woo-advanced-shipment-tracking' ),
@@ -1347,10 +1319,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
1347
  ),
1348
  'wc_ast_unclude_tracking_info' => array(
1349
  'type' => 'multiple_checkbox',
1350
- 'title' => __( 'On which order status email to include the shipment tracking info?', 'woo-advanced-shipment-tracking' ),'options' => $order_status_array,
 
1351
  'show' => true,
1352
  'class' => '',
1353
- ),
1354
  'wc_ast_show_tracking_invoice' => array(
1355
  'type' => 'checkbox',
1356
  'title' => __( 'Show tracking info in Invoice', 'woo-advanced-shipment-tracking' ),
@@ -1366,7 +1339,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1366
  );
1367
  return $form_data;
1368
 
1369
- }
1370
 
1371
  /*
1372
  * get settings tab array data
@@ -1407,7 +1380,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1407
  );
1408
  return $form_data;
1409
 
1410
- }
1411
 
1412
  /*
1413
  * get updated tracking status settings array data
@@ -1494,7 +1467,8 @@ class WC_Advanced_Shipment_Tracking_Admin {
1494
  /*
1495
  * settings form save
1496
  */
1497
- function wc_ast_settings_form_update_callback(){
 
1498
  if ( ! empty( $_POST ) && check_admin_referer( 'wc_ast_settings_form', 'wc_ast_settings_form' ) ) {
1499
 
1500
  $data = $this->get_settings_data();
@@ -1503,7 +1477,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1503
  if(isset($_POST[ $key ])){
1504
  update_option( $key, $_POST[ $key ] );
1505
  }
1506
- }
1507
 
1508
  $data = $this->get_delivered_data();
1509
 
@@ -1531,7 +1505,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1531
  if(isset($_POST[ $key ])){
1532
  update_option( $key, $_POST[ $key ] );
1533
  }
1534
- }
1535
 
1536
  $data = $this->get_partial_shipped_data();
1537
 
@@ -1603,6 +1577,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
1603
  $bg_color = get_option('wc_ast_status_label_color','#212c42');
1604
  $color = get_option('wc_ast_status_label_font_color','#fff');
1605
 
 
 
 
1606
  $ps_bg_color = get_option('wc_ast_status_partial_shipped_label_color','#0c0c0c');
1607
  $ps_color = get_option('wc_ast_status_partial_shipped_label_font_color','#fff');
1608
 
@@ -1613,7 +1590,11 @@ class WC_Advanced_Shipment_Tracking_Admin {
1613
  .order-status.status-delivered,.order-status-table .order-label.wc-delivered{
1614
  background: <?php echo $bg_color; ?>;
1615
  color: <?php echo $color; ?>;
1616
- }
 
 
 
 
1617
  .order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
1618
  background: <?php echo $ps_bg_color; ?>;
1619
  color: <?php echo $ps_color; ?>;
@@ -2114,7 +2095,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
2114
  * Change completed order email title to Shipped Order
2115
  */
2116
  public function change_completed_woocommerce_email_title($email_title, $email){
2117
- $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
2118
  // Only on backend Woocommerce Settings "Emails" tab
2119
  if($wc_ast_status_shipped == 1){
2120
  if( isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab']) && $_GET['tab'] == 'email' ) {
@@ -2138,7 +2119,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
2138
 
2139
  $wc_ast_status_delivered = get_option('wc_ast_status_delivered');
2140
  if($wc_ast_status_delivered){
2141
- if ( $order->has_status( array( 'completed' ) ) ) {
2142
  // Get Order ID (compatibility all WC versions)
2143
  $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
2144
  // Set the action button
@@ -2148,7 +2129,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
2148
  'action' => "delivered_icon", // keep "view" class for a clean button CSS
2149
  );
2150
  }
2151
- }
2152
 
2153
  if ( !$order->has_status( array( 'pickup','ready-pickup','on-hold','delivered','cancelled','failed' ) ) ) {
2154
  $actions['add_tracking'] = array(
@@ -2514,7 +2495,47 @@ class WC_Advanced_Shipment_Tracking_Admin {
2514
  </select>
2515
  <?php
2516
  }
2517
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2518
 
2519
  /**
2520
  * Get the order count for orders by shipment status
62
  /*
63
  * init from parent mail class
64
  */
65
+ public function init(){
 
 
 
 
66
  //cron_schedules
67
  add_filter( 'cron_schedules', array( $this, 'add_cron_interval') );
68
 
97
 
98
  // add bulk order filter for exported / non-exported orders
99
  add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipment_status') , 20 );
100
+ add_filter( 'request', array( $this, 'filter_orders_by_shipment_status_query' ) );
 
 
 
101
  }
102
 
103
+ // add bulk order tracking number filter for exported / non-exported orders
104
+ add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'filter_orders_by_tracking_number_query' ) );
105
+
106
+ // add bulk order filter for exported / non-exported orders
107
+ add_action( 'restrict_manage_posts', array( $this, 'filter_orders_by_shipping_provider') , 20 );
108
+ add_filter( 'request', array( $this, 'filter_orders_by_shipping_provider_query' ) );
109
+
110
  // trigger when order status changed to shipped or completed
111
  add_action( 'woocommerce_order_status_completed', array( $this, 'trigger_woocommerce_order_status_completed'), 10, 1 );
112
 
160
  if ( is_plugin_active( 'ast-tracking-per-order-items/ast-tracking-per-order-items.php' ) ) {
161
  if( !$this->licence_valid() )add_action( 'admin_notices', array( $this, 'ast_product_licence_notice') );
162
  }
163
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
  /*
166
  * add_cron_interval
206
  $range = get_option('wc_ast_api_date_range', 30 );
207
  $args = array(
208
  'status' => 'wc-completed',
209
+ 'limit' => -1,
210
  );
211
  if( $range != 0 ){
212
  $start = strtotime( date( 'Y-m-d 00:00:00', strtotime( '-'.$range.' days' ) ));
215
  }
216
 
217
  return $orders = wc_get_orders( $args );
218
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  /*
221
  * shipment api call
591
  }?>
592
  <span class=" multiple_checkbox">
593
  <label class="" for="<?php echo $key?>">
 
594
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
595
  <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
596
+ <span class="multiple_label"><?php echo $val['status']; ?></span>
597
  </br>
598
  </label>
599
  </span>
616
  <?php } ?>
617
  <span class="multiple_checkbox">
618
  <label class="" for="<?php echo $key?>">
 
619
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
620
+ <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
621
+ <span class="multiple_label"><?php echo $val['status']; ?></span>
622
  </br>
623
  </label>
624
  </span>
703
  <?php } ?>
704
  </select>
705
  </fieldset>
706
+ <?php } elseif( isset( $array['type'] ) && $array['type'] == 'radio' ){ ?>
707
+ <fieldset>
708
+ <?php foreach((array)$array['options'] as $key => $val ){
709
+ $selected = '';
710
+ if( get_option($id,$array['default']) == (string)$key )$selected = 'checked'; ?>
711
+ <span class="radio_section">
712
+ <label class="" for="<?php echo $id?>_<?php echo $key?>">
713
+ <input type="radio" id="<?php echo $id?>_<?php echo $key?>" name="<?php echo $id?>" class="<?php echo $id?>" value="<?php echo $key?>" <?php echo $selected?>/>
714
+ <span class=""><?php echo $val; ?></span>
715
+ </br>
716
+ </label>
717
+ </span></br>
718
+ <?php } ?>
719
+ </fieldset>
720
+ <?php } elseif( $array['type'] == 'key_field' ){ ?>
721
  <fieldset>
722
  <?php if($array['connected'] == true){ ?>
723
  <a href="https://my.trackship.info/" target="_blank">
756
  </tbody>
757
  </table>
758
  <?php
759
+ }
 
760
 
761
  /*
762
  * get html of fields
1031
  $form_data = array(
1032
  'wc_ast_api_enabled' => array(
1033
  'type' => 'checkbox',
1034
+ 'title' => __( 'Enable/Disable - You can enable/diable trackship, store is connected with trackship but shipment status will not update for new trackers', 'woo-advanced-shipment-tracking' ),
1035
  'show' => $show_trackship_field,
1036
  'class' => '',
1037
  ),
1038
  'wc_ast_status_change_to_delivered' => array(
1039
  'type' => 'checkbox',
1040
+ 'title' => __( 'Set order status as delivered when shipment status is delivered', 'woo-advanced-shipment-tracking' ),'show' => $show_trackship_field,
 
1041
  'class' => '',
1042
  'disabled' => $disabled_change_to_delivered,
1043
  ),
1227
  */
1228
  function get_settings_data(){
1229
 
1230
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
1231
  if($wc_ast_status_shipped == 1){
1232
  $completed_order_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
1233
  $mark_as_shipped_label = __( 'Default "mark as <span class="shipped_label">shipped</span>"', 'woo-advanced-shipment-tracking' );
1245
  'wc-processing' => 'Processing',
1246
  'wc-on-hold' => 'On hold',
1247
  'wc-completed' => 'Completed',
1248
+ 'wc-delivered' => 'Delivered',
 
1249
  'wc-cancelled' => 'Cancelled',
1250
  'wc-refunded' => 'Refunded',
1251
+ 'wc-failed' => 'Failed',
1252
+ 'wc-ready-pickup' => 'Ready for Pickup',
1253
+ 'wc-pickup' => 'Picked up'
1254
  );
1255
  foreach($default_order_status as $key=>$value){
1256
  unset($all_order_status[$key]);
1273
  "show_in_customer_invoice" => array(
1274
  'status' => __( 'Customer Invoice', 'woocommerce' ),
1275
  'type' => 'default',
1276
+ ),
1277
  "refunded" => array(
1278
  'status' => __( 'Refunded', 'woocommerce' ),
1279
  'type' => 'default',
1289
  "completed" => array(
1290
  'status' => $completed_order_label,
1291
  'type' => 'default',
1292
+ ),
1293
+ "show_in_customer_note" => array(
1294
+ 'status' => __( 'Customer note', 'woocommerce' ),
1295
+ 'type' => 'default',
1296
  ),
1297
  );
1298
+ $order_status_array = array_merge($order_status,$custom_order_status);
1299
+
1300
  if ( is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) {
1301
  $show_invoice_field = true;
1302
  } else{
1303
  $show_invoice_field = false;
1304
+ }
1305
 
1306
+ $form_data = array(
1307
  'wc_ast_status_shipped' => array(
1308
  'type' => 'checkbox',
1309
  'title' => __( 'Rename the “Completed” Order status to “Shipped”', 'woo-advanced-shipment-tracking' ),
1319
  ),
1320
  'wc_ast_unclude_tracking_info' => array(
1321
  'type' => 'multiple_checkbox',
1322
+ 'title' => __( 'On which order status email to include the shipment tracking info?', 'woo-advanced-shipment-tracking' ),
1323
+ 'options' => $order_status_array,
1324
  'show' => true,
1325
  'class' => '',
1326
+ ),
1327
  'wc_ast_show_tracking_invoice' => array(
1328
  'type' => 'checkbox',
1329
  'title' => __( 'Show tracking info in Invoice', 'woo-advanced-shipment-tracking' ),
1339
  );
1340
  return $form_data;
1341
 
1342
+ }
1343
 
1344
  /*
1345
  * get settings tab array data
1380
  );
1381
  return $form_data;
1382
 
1383
+ }
1384
 
1385
  /*
1386
  * get updated tracking status settings array data
1467
  /*
1468
  * settings form save
1469
  */
1470
+ function wc_ast_settings_form_update_callback(){
1471
+ //echo '<pre>'; print_r($_POST);echo '</pre>';exit;
1472
  if ( ! empty( $_POST ) && check_admin_referer( 'wc_ast_settings_form', 'wc_ast_settings_form' ) ) {
1473
 
1474
  $data = $this->get_settings_data();
1477
  if(isset($_POST[ $key ])){
1478
  update_option( $key, $_POST[ $key ] );
1479
  }
1480
+ }
1481
 
1482
  $data = $this->get_delivered_data();
1483
 
1505
  if(isset($_POST[ $key ])){
1506
  update_option( $key, $_POST[ $key ] );
1507
  }
1508
+ }
1509
 
1510
  $data = $this->get_partial_shipped_data();
1511
 
1577
  $bg_color = get_option('wc_ast_status_label_color','#212c42');
1578
  $color = get_option('wc_ast_status_label_font_color','#fff');
1579
 
1580
+ $shipped_bg_color = get_option('wc_ast_shipped_status_label_color','#b7b7b7');
1581
+ $shipped_color = get_option('wc_ast_shipped_status_label_font_color','#fff');
1582
+
1583
  $ps_bg_color = get_option('wc_ast_status_partial_shipped_label_color','#0c0c0c');
1584
  $ps_color = get_option('wc_ast_status_partial_shipped_label_font_color','#fff');
1585
 
1590
  .order-status.status-delivered,.order-status-table .order-label.wc-delivered{
1591
  background: <?php echo $bg_color; ?>;
1592
  color: <?php echo $color; ?>;
1593
+ }
1594
+ .order-status.status-shipped,.order-status-table .order-label.wc-shipped{
1595
+ background: <?php echo $shipped_bg_color; ?>;
1596
+ color: <?php echo $shipped_color; ?>;
1597
+ }
1598
  .order-status.status-partial-shipped,.order-status-table .order-label.wc-partially-shipped{
1599
  background: <?php echo $ps_bg_color; ?>;
1600
  color: <?php echo $ps_color; ?>;
2095
  * Change completed order email title to Shipped Order
2096
  */
2097
  public function change_completed_woocommerce_email_title($email_title, $email){
2098
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
2099
  // Only on backend Woocommerce Settings "Emails" tab
2100
  if($wc_ast_status_shipped == 1){
2101
  if( isset($_GET['page']) && $_GET['page'] == 'wc-settings' && isset($_GET['tab']) && $_GET['tab'] == 'email' ) {
2119
 
2120
  $wc_ast_status_delivered = get_option('wc_ast_status_delivered');
2121
  if($wc_ast_status_delivered){
2122
+ if ( $order->has_status( array( 'completed' ) ) || $order->has_status( array( 'shipped' ) )) {
2123
  // Get Order ID (compatibility all WC versions)
2124
  $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
2125
  // Set the action button
2129
  'action' => "delivered_icon", // keep "view" class for a clean button CSS
2130
  );
2131
  }
2132
+ }
2133
 
2134
  if ( !$order->has_status( array( 'pickup','ready-pickup','on-hold','delivered','cancelled','failed' ) ) ) {
2135
  $actions['add_tracking'] = array(
2495
  </select>
2496
  <?php
2497
  }
2498
+ }
2499
+
2500
+ /**
2501
+ * Add bulk filter for Shipping provider in orders list
2502
+ *
2503
+ * @since 2.4
2504
+ */
2505
+ public function filter_orders_by_shipping_provider(){
2506
+ global $typenow, $wpdb;
2507
+ $default_shippment_providers = $wpdb->get_results( "SELECT * FROM $this->table WHERE display_in_order = 1" );
2508
+ //echo '<pre>';print_r($default_shippment_providers);echo '</pre>';
2509
+ if ( 'shop_order' === $typenow ) { ?>
2510
+ <select name="_shop_order_shipping_provider" id="dropdown_shop_order_shipping_provider">
2511
+ <option value=""><?php _e( 'Filter by shipping provider', 'woo-advanced-shipment-tracking' ); ?></option>
2512
+ <?php foreach ( $default_shippment_providers as $provider ) : ?>
2513
+ <option value="<?php echo esc_attr( $provider->ts_slug ); ?>" <?php echo esc_attr( isset( $_GET['_shop_order_shipping_provider'] ) ? selected( $provider->ts_slug, $_GET['_shop_order_shipping_provider'], false ) : '' ); ?>>
2514
+ <?php printf( '%1$s', esc_html( $provider->provider_name ) ); ?>
2515
+ </option>
2516
+ <?php endforeach; ?>
2517
+ </select>
2518
+ <?php
2519
+ }
2520
+ }
2521
+
2522
+ /**
2523
+ * Process bulk filter action for shipment status orders
2524
+ *
2525
+ * @since 3.0.0
2526
+ * @param array $vars query vars without filtering
2527
+ * @return array $vars query vars with (maybe) filtering
2528
+ */
2529
+ public function filter_orders_by_shipping_provider_query( $vars ){
2530
+ global $typenow;
2531
+ if ( 'shop_order' === $typenow && isset( $_GET['_shop_order_shipping_provider'] ) && $_GET['_shop_order_shipping_provider'] != '') {
2532
+ $vars['meta_key'] = '_wc_shipment_tracking_items';
2533
+ $vars['meta_value'] = $_GET['_shop_order_shipping_provider'];
2534
+ $vars['meta_compare'] = 'LIKE';
2535
+ }
2536
+
2537
+ return $vars;
2538
+ }
2539
 
2540
  /**
2541
  * Get the order count for orders by shipment status
includes/class-wc-advanced-shipment-tracking-api-call.php CHANGED
@@ -79,8 +79,10 @@ class WC_Advanced_Shipment_Tracking_Api_Call {
79
  $shipment_status[$key]['est_delivery_date'] = '';
80
 
81
  update_post_meta( $order->get_id(), "shipment_status", $shipment_status);
82
- update_option('trackers_balance',$body['trackers_balance']);
83
 
 
 
 
84
  } else {
85
  //error like 403 500 502
86
  $timestamp = time() + 5*60;
79
  $shipment_status[$key]['est_delivery_date'] = '';
80
 
81
  update_post_meta( $order->get_id(), "shipment_status", $shipment_status);
 
82
 
83
+ if(isset($body['trackers_balance'])){
84
+ update_option('trackers_balance',$body['trackers_balance']);
85
+ }
86
  } else {
87
  //error like 403 500 502
88
  $timestamp = time() + 5*60;
includes/class-wc-advanced-shipment-tracking-front.php CHANGED
@@ -171,7 +171,7 @@ class WC_Advanced_Shipment_Tracking_Front {
171
 
172
  } else{
173
  ob_start();
174
-
175
  $wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
176
  $order_id = $wast->get_formated_order_id($order_id);
177
 
@@ -401,6 +401,7 @@ class WC_Advanced_Shipment_Tracking_Front {
401
  } else {
402
  $tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
403
  }
 
404
  $shipment_status = get_post_meta( $order_id, "shipment_status", true);
405
  if(!$tracking_items){
406
  ob_start();
@@ -551,7 +552,7 @@ class WC_Advanced_Shipment_Tracking_Front {
551
  <div class="tracking-header tracking-desktop-header">
552
  <div class="col-md col-md-6">
553
  <span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span><br>
554
- <span class="tracking-number"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>: <strong><?php echo $tracking_number; ?></strong></span>
555
  <h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered" || $tracker->ep_status == "available_for_pickup") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-warning'; } else{ echo 'text-secondary'; } ?>">
556
  <?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?>
557
  </h1>
@@ -577,7 +578,7 @@ class WC_Advanced_Shipment_Tracking_Front {
577
  <img class="provider_image" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/shipment-provider-img/<?php echo sanitize_title($tracking_provider); ?>.png">
578
  </div>
579
  <div class="header_top_right">
580
- <span class="tracking-number"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>: <strong><?php echo $tracking_number; ?></strong></span><br>
581
  <span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span>
582
  </div>
583
  </div>
171
 
172
  } else{
173
  ob_start();
174
+ echo $order_id;
175
  $wast = WC_Advanced_Shipment_Tracking_Actions::get_instance();
176
  $order_id = $wast->get_formated_order_id($order_id);
177
 
401
  } else {
402
  $tracking_items = $order->get_meta( '_wc_shipment_tracking_items', true );
403
  }
404
+
405
  $shipment_status = get_post_meta( $order_id, "shipment_status", true);
406
  if(!$tracking_items){
407
  ob_start();
552
  <div class="tracking-header tracking-desktop-header">
553
  <div class="col-md col-md-6">
554
  <span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span><br>
555
+ <span class="tracking-number"><span class="header_tracking_provider"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>:</span> <strong><?php echo $tracking_number; ?></strong></span>
556
  <h1 class="shipment_status_heading <?php if($tracker->ep_status == "delivered" || $tracker->ep_status == "available_for_pickup") { echo 'text-success'; } elseif($tracker->ep_status == "return_to_sender" || $tracker->ep_status == "failure") { echo 'text-warning'; } else{ echo 'text-secondary'; } ?>">
557
  <?php echo apply_filters("trackship_status_filter",$tracker->ep_status);?>
558
  </h1>
578
  <img class="provider_image" src="<?php echo wc_advanced_shipment_tracking()->plugin_dir_url()?>assets/shipment-provider-img/<?php echo sanitize_title($tracking_provider); ?>.png">
579
  </div>
580
  <div class="header_top_right">
581
+ <span class="tracking-number"><span class="header_tracking_provider"><?php echo apply_filters( 'ast_provider_title', esc_html( $tracking_provider )); ?>:</span> <strong><?php echo $tracking_number; ?></strong></span><br>
582
  <span class="tracking-number"><?php _e( 'Order', 'woocommerce' ); ?>: <strong>#<?php echo apply_filters( 'ast_order_number_filter', $order_id); ?></strong></span>
583
  </div>
584
  </div>
includes/class-wc-advanced-shipment-tracking-install.php CHANGED
@@ -1746,6 +1746,12 @@ class WC_Advanced_Shipment_Tracking_Install {
1746
  $wpdb->update( $this->table, $data_array, $where_array);
1747
  }
1748
  update_option( 'wc_advanced_shipment_tracking', '3.10');
 
 
 
 
 
 
1749
  }
1750
  }
1751
  }
1746
  $wpdb->update( $this->table, $data_array, $where_array);
1747
  }
1748
  update_option( 'wc_advanced_shipment_tracking', '3.10');
1749
+ }
1750
+ if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'3.13', '<') ){
1751
+ $wc_ast_unclude_tracking_info = get_option('wc_ast_unclude_tracking_info');
1752
+ $wc_ast_unclude_tracking_info['show_in_customer_note'] = 0;
1753
+ update_option('wc_ast_unclude_tracking_info',$wc_ast_unclude_tracking_info);
1754
+ update_option( 'wc_advanced_shipment_tracking', '3.13');
1755
  }
1756
  }
1757
  }
includes/class-wc-advanced-shipment-tracking-settings.php CHANGED
@@ -54,7 +54,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
54
  public function init(){
55
 
56
  //rename order status + rename bulk action + rename filter
57
- add_filter( 'wc_order_statuses', array( $this, 'wc_renaming_order_status') );
58
  add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses'), 10, 1 );
59
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions'), 50, 1 );
60
 
@@ -75,8 +75,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
75
  add_filter( 'woocommerce_order_is_paid_statuses', array( $this, 'delivered_woocommerce_order_is_paid_statuses' ) );
76
  //add bulk action
77
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'add_bulk_actions'), 50, 1 );
78
- }
79
-
80
  //new order status
81
  $updated_tracking_status = get_option( "wc_ast_status_updated_tracking", 0);
82
  if( $updated_tracking_status == true ){
@@ -132,7 +131,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
132
  /**
133
  * Register new status : Delivered
134
  **/
135
- function register_order_status() {
136
  register_post_status( 'wc-delivered', array(
137
  'label' => __( 'Delivered', 'woo-advanced-shipment-tracking' ),
138
  'public' => true,
@@ -141,7 +140,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
141
  'exclude_from_search' => false,
142
  'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
143
  ) );
144
- }
145
 
146
  /**
147
  * Register new status : Updated Tracking
@@ -174,7 +173,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
174
  /*
175
  * add status after completed
176
  */
177
- function add_delivered_to_order_statuses( $order_statuses ) {
178
  $new_order_statuses = array();
179
  foreach ( $order_statuses as $key => $status ) {
180
  $new_order_statuses[ $key ] = $status;
@@ -184,12 +183,12 @@ class WC_Advanced_Shipment_Tracking_Settings {
184
  }
185
 
186
  return $new_order_statuses;
187
- }
188
 
189
  /*
190
  * add status after completed
191
  */
192
- function add_updated_tracking_to_order_statuses( $order_statuses ) {
193
  $new_order_statuses = array();
194
  foreach ( $order_statuses as $key => $status ) {
195
  $new_order_statuses[ $key ] = $status;
@@ -203,7 +202,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
203
  /*
204
  * add status after completed
205
  */
206
- function add_partial_shipped_to_order_statuses( $order_statuses ) {
207
  $new_order_statuses = array();
208
  foreach ( $order_statuses as $key => $status ) {
209
  $new_order_statuses[ $key ] = $status;
@@ -220,7 +219,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
220
  function include_custom_order_status_to_reports( $statuses ){
221
  if($statuses)$statuses[] = 'delivered';
222
  return $statuses;
223
- }
224
 
225
  /*
226
  * Adding the updated-tracking order status to the default woocommerce order statuses
@@ -244,7 +243,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
244
  function delivered_woocommerce_order_is_paid_statuses( $statuses ) {
245
  $statuses[] = 'delivered';
246
  return $statuses;
247
- }
248
 
249
  /*
250
  * mark status as a paid.
@@ -307,7 +306,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
307
  }
308
  }
309
  return $order_statuses;
310
- }
311
 
312
  /*
313
  * define the woocommerce_register_shop_order_post_statuses callback
@@ -445,7 +444,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
445
  $default_provider = get_option("wc_ast_default_provider" );
446
  $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
447
 
448
- $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
449
  if($wc_ast_status_shipped == 1){
450
  $change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
451
  $shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
@@ -461,7 +460,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
461
  <div class="trackingpopup_row">
462
  <h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?> - #<?php echo $custom_order_number; ?></h2>
463
  <form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
464
- <p class="form-field">
465
  <label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
466
  <select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width:100%;">
467
  <option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
@@ -485,11 +484,11 @@ class WC_Advanced_Shipment_Tracking_Settings {
485
  </p>
486
  <p class="form-field tracking_number_field">
487
  <label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
488
- <input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="">
489
  </p>
490
  <p class="form-field tracking_product_code_field">
491
  <label for="tracking_product_code"><?php _e( 'Product Code:', 'woo-advanced-shipment-tracking'); ?></label>
492
- <input type="text" class="short" style="" name="tracking_product_code" id="tracking_product_code" value="" autofocus>
493
  </p>
494
  <p class="form-field date_shipped_field">
495
  <label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
@@ -497,6 +496,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
497
  </p>
498
  <?php
499
 
 
500
  do_action("ast_tracking_form_between_form", $order_id);
501
 
502
  if($wc_ast_status_partial_shipped){ ?>
@@ -530,7 +530,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
530
  /*
531
  * define the item in the meta box by adding an item to the $actions array
532
  */
533
- function add_order_meta_box_actions( $actions ) {
534
  $actions['resend_delivered_order_notification'] = __( 'Resend delivered order notification', 'woo-advanced-shipment-tracking' );
535
  return $actions;
536
  }
@@ -588,8 +588,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
588
 
589
  if(is_array($shipment_status)){
590
  $shipment_status_merge = array_merge($shipment_status_merge, $shipment_status);
591
- }
592
-
593
  }
594
 
595
  foreach($tracking_items_results as $order){
@@ -747,7 +746,12 @@ class WC_Advanced_Shipment_Tracking_Settings {
747
  ]
748
  }
749
  );
750
- </script>
 
 
 
 
 
751
  <div class="ast-dashborad-widget">
752
 
753
  <input id="tab_s_providers" type="radio" name="tabs" class="widget_tab_input" checked>
@@ -980,4 +984,4 @@ class WC_Advanced_Shipment_Tracking_Settings {
980
  <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>
981
  <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>
982
  <?php }
983
- }
54
  public function init(){
55
 
56
  //rename order status + rename bulk action + rename filter
57
+ add_filter( 'wc_order_statuses', array( $this, 'wc_renaming_order_status') );
58
  add_filter( 'woocommerce_register_shop_order_post_statuses', array( $this, 'filter_woocommerce_register_shop_order_post_statuses'), 10, 1 );
59
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'modify_bulk_actions'), 50, 1 );
60
 
75
  add_filter( 'woocommerce_order_is_paid_statuses', array( $this, 'delivered_woocommerce_order_is_paid_statuses' ) );
76
  //add bulk action
77
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'add_bulk_actions'), 50, 1 );
78
+ }
 
79
  //new order status
80
  $updated_tracking_status = get_option( "wc_ast_status_updated_tracking", 0);
81
  if( $updated_tracking_status == true ){
131
  /**
132
  * Register new status : Delivered
133
  **/
134
+ function register_order_status() {
135
  register_post_status( 'wc-delivered', array(
136
  'label' => __( 'Delivered', 'woo-advanced-shipment-tracking' ),
137
  'public' => true,
140
  'exclude_from_search' => false,
141
  'label_count' => _n_noop( 'Delivered <span class="count">(%s)</span>', 'Delivered <span class="count">(%s)</span>', 'woo-advanced-shipment-tracking' )
142
  ) );
143
+ }
144
 
145
  /**
146
  * Register new status : Updated Tracking
173
  /*
174
  * add status after completed
175
  */
176
+ function add_delivered_to_order_statuses( $order_statuses ) {
177
  $new_order_statuses = array();
178
  foreach ( $order_statuses as $key => $status ) {
179
  $new_order_statuses[ $key ] = $status;
183
  }
184
 
185
  return $new_order_statuses;
186
+ }
187
 
188
  /*
189
  * add status after completed
190
  */
191
+ function add_updated_tracking_to_order_statuses( $order_statuses ) {
192
  $new_order_statuses = array();
193
  foreach ( $order_statuses as $key => $status ) {
194
  $new_order_statuses[ $key ] = $status;
202
  /*
203
  * add status after completed
204
  */
205
+ function add_partial_shipped_to_order_statuses( $order_statuses ) {
206
  $new_order_statuses = array();
207
  foreach ( $order_statuses as $key => $status ) {
208
  $new_order_statuses[ $key ] = $status;
219
  function include_custom_order_status_to_reports( $statuses ){
220
  if($statuses)$statuses[] = 'delivered';
221
  return $statuses;
222
+ }
223
 
224
  /*
225
  * Adding the updated-tracking order status to the default woocommerce order statuses
243
  function delivered_woocommerce_order_is_paid_statuses( $statuses ) {
244
  $statuses[] = 'delivered';
245
  return $statuses;
246
+ }
247
 
248
  /*
249
  * mark status as a paid.
306
  }
307
  }
308
  return $order_statuses;
309
+ }
310
 
311
  /*
312
  * define the woocommerce_register_shop_order_post_statuses callback
444
  $default_provider = get_option("wc_ast_default_provider" );
445
  $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
446
 
447
+ $wc_ast_status_shipped = get_option('wc_ast_status_shipped',0);
448
  if($wc_ast_status_shipped == 1){
449
  $change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
450
  $shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
460
  <div class="trackingpopup_row">
461
  <h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?> - #<?php echo $custom_order_number; ?></h2>
462
  <form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
463
+ <p class="form-field" style="margin-bottom: 10px;">
464
  <label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
465
  <select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width:100%;">
466
  <option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
484
  </p>
485
  <p class="form-field tracking_number_field">
486
  <label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
487
+ <input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
488
  </p>
489
  <p class="form-field tracking_product_code_field">
490
  <label for="tracking_product_code"><?php _e( 'Product Code:', 'woo-advanced-shipment-tracking'); ?></label>
491
+ <input type="text" class="short" style="" name="tracking_product_code" id="tracking_product_code" value="">
492
  </p>
493
  <p class="form-field date_shipped_field">
494
  <label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
496
  </p>
497
  <?php
498
 
499
+ do_action("ast_after_tracking_field", $order_id);
500
  do_action("ast_tracking_form_between_form", $order_id);
501
 
502
  if($wc_ast_status_partial_shipped){ ?>
530
  /*
531
  * define the item in the meta box by adding an item to the $actions array
532
  */
533
+ function add_order_meta_box_actions( $actions ) {
534
  $actions['resend_delivered_order_notification'] = __( 'Resend delivered order notification', 'woo-advanced-shipment-tracking' );
535
  return $actions;
536
  }
588
 
589
  if(is_array($shipment_status)){
590
  $shipment_status_merge = array_merge($shipment_status_merge, $shipment_status);
591
+ }
 
592
  }
593
 
594
  foreach($tracking_items_results as $order){
746
  ]
747
  }
748
  );
749
+ </script>
750
+ <style>
751
+ a[href="http://www.amcharts.com"] {
752
+ display: none !important;
753
+ }
754
+ </style>
755
  <div class="ast-dashborad-widget">
756
 
757
  <input id="tab_s_providers" type="radio" name="tabs" class="widget_tab_input" checked>
984
  <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>
985
  <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>
986
  <?php }
987
+ }
includes/class-wc-advanced-shipment-tracking.php CHANGED
@@ -205,121 +205,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
205
  echo '–';
206
  }
207
  return apply_filters( 'woocommerce_shipment_tracking_get_shipment_tracking_column', ob_get_clean(), $order_id, $tracking_items );
208
- }
209
-
210
- /**
211
- * Lightbox for add tracking number from orders list
212
- */
213
- public function add_inline_tracking_lightbox(){
214
- global $wpdb;
215
- $WC_Countries = new WC_Countries();
216
- $countries = $WC_Countries->get_countries();
217
-
218
- $woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
219
-
220
- if( is_multisite() ){
221
- if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
222
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
223
- }
224
- if ( is_plugin_active_for_network( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) {
225
- $main_blog_prefix = $wpdb->get_blog_prefix(BLOG_ID_CURRENT_SITE);
226
- $woo_shippment_table_name = $main_blog_prefix."woo_shippment_provider";
227
- } else{
228
- $woo_shippment_table_name = $wpdb->prefix."woo_shippment_provider";
229
- }
230
- } else{
231
- $woo_shippment_table_name = $wpdb->prefix."woo_shippment_provider";
232
- }
233
- $shippment_countries = $wpdb->get_results( "SELECT shipping_country FROM $woo_shippment_table_name WHERE display_in_order = 1 GROUP BY shipping_country" );
234
-
235
- $shippment_providers = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name" );
236
-
237
- $default_provider = get_option("wc_ast_default_provider" );
238
- $wc_ast_default_mark_shipped = get_option("wc_ast_default_mark_shipped" );
239
-
240
- $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
241
- if($wc_ast_status_shipped == 1){
242
- $change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
243
- $shipped_label = __( 'Shipped', 'woo-advanced-shipment-tracking' );
244
- } else{
245
- $change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
246
- $shipped_label = __( 'Completed', 'woo-advanced-shipment-tracking' );
247
- }
248
-
249
- $wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
250
- ?>
251
- <div id="" class="trackingpopup_wrapper add_tracking_popup" style="display:none;">
252
- <div class="trackingpopup_row">
253
- <h3 class="popup_title"><?php _e( 'Add Tracking Number', 'woo-advanced-shipment-tracking'); ?></h2>
254
- <form id="add_tracking_number_form" method="POST" class="add_tracking_number_form">
255
- <p class="form-field tracking_number_field ">
256
- <label for="tracking_number"><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking'); ?></label>
257
- <input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" placeholder="">
258
- </p>
259
- <p class="form-field">
260
- <select class="chosen_select" id="tracking_provider" name="tracking_provider" style="width: 100%;max-width: 100%;">
261
- <option value=""><?php _e( 'Shipping Provider:', 'woo-advanced-shipment-tracking' ); ?></option>
262
- <?php
263
- foreach($shippment_countries as $s_c){
264
- if($s_c->shipping_country != 'Global'){
265
- $country_name = esc_attr( $WC_Countries->countries[$s_c->shipping_country] );
266
- } else{
267
- $country_name = 'Global';
268
- }
269
- echo '<optgroup label="' . $country_name . '">';
270
- $country = $s_c->shipping_country;
271
- $shippment_providers_by_country = $wpdb->get_results( "SELECT * FROM $woo_shippment_table_name WHERE shipping_country = '$country' AND display_in_order = 1" );
272
- foreach ( $shippment_providers_by_country as $providers ) {
273
- $selected = ( $default_provider == esc_attr( $providers->ts_slug ) ) ? 'selected' : '';
274
- echo '<option value="' . esc_attr( $providers->ts_slug ) . '" '.$selected. '>' . esc_html( $providers->provider_name ) . '</option>';
275
- }
276
- echo '</optgroup>';
277
- } ?>
278
- </select>
279
- </p>
280
- <p class="form-field tracking_number_field ">
281
- <label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
282
- <input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" placeholder="">
283
- </p>
284
- <p class="form-field date_shipped_field">
285
- <label for="date_shipped"><?php _e( 'Date shipped:', 'woo-advanced-shipment-tracking'); ?></label>
286
- <input type="text" class="date-picker-field" style="" name="date_shipped" id="date_shipped" value="<?php echo date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ); ?>" placeholder="<?php echo date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), time() ); ?>">
287
- </p>
288
- <?php
289
-
290
- //do_action("ast_tracking_form_between_form", $post->ID);
291
-
292
- if($wc_ast_status_partial_shipped){ ?>
293
- <fieldset class="form-field change_order_to_shipped_field ">
294
- <legend><?php _e( 'Mark order as:', 'woo-advanced-shipment-tracking'); ?></legend>
295
- <ul class="wc-radios">
296
- <li><label><input name="change_order_to_shipped" value="change_order_to_shipped" type="checkbox" class="select short" style=""><?php _e( $shipped_label, 'woo-advanced-shipment-tracking'); ?></label></li>
297
- <li><label><input name="change_order_to_shipped" value="change_order_to_partial_shipped" type="checkbox" class="select short" style=""><?php _e( 'Partial Shipped', 'woo-advanced-shipment-tracking'); ?></label></li>
298
- </ul>
299
- </fieldset>
300
- <?php } else{ ?>
301
- <p class="form-field change_order_to_shipped_field ">
302
- <label for="change_order_to_shipped"><?php echo $change_order_status_label; ?></label>
303
- <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'; }?>>
304
- </p>
305
- <?php } ?>
306
- <p class="" style="text-align:left;">
307
- <input type="hidden" name="action" value="add_inline_tracking_number">
308
- <input type="hidden" name="order_id" id="order_id" value="">
309
- <input type="submit" name="Submit" value="Save Tracking" class="button-primary btn_green">
310
- </p>
311
- </form>
312
- </div>
313
- <div class="popupclose"></div>
314
- </div>
315
- <?php
316
- //wp_enqueue_script( 'wc-admin-meta-boxes' );
317
- }
318
 
319
  /**
320
  * Add the meta box for shipment info on the order page
321
  */
322
- public function add_meta_box() {
323
  add_meta_box( 'woocommerce-advanced-shipment-tracking', __( 'Shipment Tracking', 'woo-advanced-shipment-tracking' ), array( $this, 'meta_box' ), 'shop_order', 'side', 'high' );
324
  }
325
 
@@ -327,8 +218,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
327
  * Returns a HTML node for a tracking item for the admin meta box
328
  */
329
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
330
- $formatted = $this->get_formatted_tracking_item( $order_id, $item );
331
-
332
  ?>
333
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
334
  <div class="tracking-content">
@@ -404,7 +294,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
404
  */
405
  public function meta_box() {
406
  global $post;
407
- global $wpdb;
408
 
409
  $WC_Countries = new WC_Countries();
410
  $countries = $WC_Countries->get_countries();
@@ -443,7 +333,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
443
  $cbvalue = 1;
444
  }
445
  }
446
-
447
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
448
  if($wc_ast_status_shipped == 1){
449
  $change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
@@ -451,9 +341,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
451
  } else{
452
  $change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
453
  $shipped_label = 'Completed';
454
- }
455
-
456
-
457
 
458
  echo '<div id="tracking-items">';
459
  if ( count( $tracking_items ) > 0 ) {
@@ -502,14 +390,20 @@ class WC_Advanced_Shipment_Tracking_Actions {
502
  'id' => 'wc_shipment_tracking_create_nonce',
503
  'value' => wp_create_nonce( 'create-tracking-item' ),
504
  ) );
505
-
506
- woocommerce_wp_text_input( array(
 
 
 
 
 
507
  'id' => 'tracking_number',
508
  'label' => __( 'Tracking number:', 'woo-advanced-shipment-tracking' ),
509
  'placeholder' => '',
510
  'description' => '',
511
  'value' => '',
512
- ) );
 
513
 
514
  woocommerce_wp_text_input( array(
515
  'id' => 'tracking_product_code',
@@ -527,7 +421,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
527
  'class' => 'date-picker-field',
528
  'value' => date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ),
529
  ) );
530
-
 
531
  do_action("ast_tracking_form_between_form", $post->ID);
532
 
533
  if($wc_ast_status_partial_shipped){
@@ -683,11 +578,12 @@ class WC_Advanced_Shipment_Tracking_Actions {
683
  'tracking_product_code' => $tracking_product_code,
684
  'date_shipped' => wc_clean( $_POST['date_shipped'] ),
685
  );
686
-
 
 
687
  $tracking_item = $this->add_tracking_item( $order_id, $args );
688
 
689
- if($_POST['change_order_to_shipped'] == 'change_order_to_shipped'){
690
-
691
  if('completed' == $order->get_status()){
692
  WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
693
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
@@ -726,31 +622,21 @@ class WC_Advanced_Shipment_Tracking_Actions {
726
  'tracking_product_code' => $tracking_product_code,
727
  'date_shipped' => wc_clean( $_POST['date_shipped'] ),
728
  );
729
-
 
 
730
  $tracking_item = $this->add_tracking_item( $order_id, $args );
 
731
 
732
- if($_POST['change_order_to_shipped'] == 'change_order_to_shipped' || $_POST['change_order_to_shipped'] == 'yes'){
733
- $wc_ast_completed_to_shipped = get_option('wc_ast_completed_to_shipped','wc_ast_rename_to_shipped');
734
- $order = new WC_Order($order_id);
735
- if($wc_ast_completed_to_shipped == 'wc_ast_rename_to_shipped'){
736
- if('completed' == $order->get_status()){
737
- $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
738
- } else{
739
- $order->update_status('completed');
740
- }
741
- } else if($wc_ast_completed_to_shipped == 'wc_ast_create_shipped' && get_option('wc_ast_status_shipped_active')){
742
- if('shipped' == $order->get_status()){
743
- $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
744
- } else{
745
- $order->update_status('shipped');
746
- }
747
- }
748
-
749
- } elseif($_POST['change_order_to_shipped'] == 'change_order_to_partial_shipped'){
750
- $order = new WC_Order($order_id);
751
-
752
- $previous_order_status = $order->get_status();
753
-
754
  if('partial-shipped' == $previous_order_status){
755
  WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
756
  }
@@ -851,9 +737,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
851
 
852
  if ( is_a( $email, 'WC_Email_Customer_Invoice' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_invoice']) && $wc_ast_unclude_tracking_info['show_in_customer_invoice'] == 0){
853
  return;
854
- }
 
 
 
 
855
 
856
- if(isset($wc_ast_unclude_tracking_info[$order_status]) && $wc_ast_unclude_tracking_info[$order_status] == 0 && !is_a( $email, 'WC_Email_Customer_Invoice' )){
857
  return;
858
  }
859
 
@@ -998,7 +888,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
998
  public function get_formatted_tracking_item( $order_id, $tracking_item ) {
999
  $formatted = array();
1000
  $tracking_items = $this->get_tracking_items( $order_id );
1001
-
1002
  foreach($tracking_items as $key=>$item){
1003
  if($item['tracking_id'] == $tracking_item['tracking_id']){
1004
  $shipmet_key = $key;
@@ -1203,6 +1093,8 @@ class WC_Advanced_Shipment_Tracking_Actions {
1203
  $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
1204
  }
1205
 
 
 
1206
  $tracking_items = $this->get_tracking_items( $order_id );
1207
  if($tracking_items){
1208
  $key = $this->seach_tracking_number_in_items($args['tracking_number'], $tracking_items);
@@ -1213,16 +1105,15 @@ class WC_Advanced_Shipment_Tracking_Actions {
1213
  }
1214
  } else{
1215
  $tracking_items[] = $tracking_item;
1216
- }
1217
- //echo '<pre>';print_r($args['products_list']);echo '</pre>';
1218
- //echo '<pre>';print_r($tracking_items);echo '</pre>';exit;
1219
-
1220
  $this->save_tracking_items( $order_id, $tracking_items );
1221
 
1222
  $status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
1223
  $ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
1224
- if( $status_shipped == 1){
1225
- $order = new WC_Order( $order_id );
 
1226
  if('completed' == $order->get_status()){
1227
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1228
  } else{
@@ -1232,17 +1123,14 @@ class WC_Advanced_Shipment_Tracking_Actions {
1232
 
1233
  if( $status_shipped == 2){
1234
  $wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
1235
- if($wc_ast_status_partial_shipped){
1236
- $order = new WC_Order( $order_id );
1237
  $order->update_status('partial-shipped');
1238
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1239
  }
1240
  }
1241
 
1242
  $formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
1243
- $tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
1244
-
1245
- $order = wc_get_order( $order_id );
1246
 
1247
  // The text for the note
1248
  $note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
@@ -1311,8 +1199,9 @@ class WC_Advanced_Shipment_Tracking_Actions {
1311
 
1312
  $status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
1313
  $ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
1314
- if( $status_shipped == 1){
1315
- $order = new WC_Order( $order_id );
 
1316
  if('completed' == $order->get_status()){
1317
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1318
  } else{
@@ -1320,11 +1209,20 @@ class WC_Advanced_Shipment_Tracking_Actions {
1320
  }
1321
  }
1322
 
1323
- if( $status_shipped == 2){
1324
- $order = new WC_Order( $order_id );
1325
  $order->update_status('partial-shipped');
1326
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1327
  }
 
 
 
 
 
 
 
 
 
 
1328
  return $tracking_item;
1329
  }
1330
 
@@ -1558,7 +1456,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
1558
  }
1559
  }
1560
 
1561
- if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php' ) ) {
1562
 
1563
  // search for the order by custom order number
1564
  $query_args = array(
@@ -1657,6 +1555,33 @@ class WC_Advanced_Shipment_Tracking_Actions {
1657
  wp_reset_postdata();
1658
  }
1659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1660
  return $order_id;
1661
  }
1662
 
@@ -1678,7 +1603,7 @@ class WC_Advanced_Shipment_Tracking_Actions {
1678
  }
1679
  }
1680
 
1681
- if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php' ) ) {
1682
  $custom_order_number = get_post_meta( $order_id, '_order_number_formatted', true );
1683
  if(!empty($custom_order_number)){
1684
  return $custom_order_number;
@@ -1707,7 +1632,13 @@ class WC_Advanced_Shipment_Tracking_Actions {
1707
  if(!empty($custom_order_number)){
1708
  return $custom_order_number;
1709
  }
1710
- }
 
 
 
 
 
 
1711
  }
1712
 
1713
  public function get_option_value_from_array($array,$key,$default_value){
@@ -1723,4 +1654,29 @@ class WC_Advanced_Shipment_Tracking_Actions {
1723
  }
1724
  return $value;
1725
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1726
  }
205
  echo '–';
206
  }
207
  return apply_filters( 'woocommerce_shipment_tracking_get_shipment_tracking_column', ob_get_clean(), $order_id, $tracking_items );
208
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  /**
211
  * Add the meta box for shipment info on the order page
212
  */
213
+ public function add_meta_box() {
214
  add_meta_box( 'woocommerce-advanced-shipment-tracking', __( 'Shipment Tracking', 'woo-advanced-shipment-tracking' ), array( $this, 'meta_box' ), 'shop_order', 'side', 'high' );
215
  }
216
 
218
  * Returns a HTML node for a tracking item for the admin meta box
219
  */
220
  public function display_html_tracking_item_for_meta_box( $order_id, $item ) {
221
+ $formatted = $this->get_formatted_tracking_item( $order_id, $item );
 
222
  ?>
223
  <div class="tracking-item" id="tracking-item-<?php echo esc_attr( $item['tracking_id'] ); ?>">
224
  <div class="tracking-content">
294
  */
295
  public function meta_box() {
296
  global $post;
297
+ global $wpdb;
298
 
299
  $WC_Countries = new WC_Countries();
300
  $countries = $WC_Countries->get_countries();
333
  $cbvalue = 1;
334
  }
335
  }
336
+
337
  $wc_ast_status_shipped = get_option('wc_ast_status_shipped');
338
  if($wc_ast_status_shipped == 1){
339
  $change_order_status_label = __( 'Mark as Shipped?', 'woo-advanced-shipment-tracking' );
341
  } else{
342
  $change_order_status_label = __( 'Mark as Completed?', 'woo-advanced-shipment-tracking' );
343
  $shipped_label = 'Completed';
344
+ }
 
 
345
 
346
  echo '<div id="tracking-items">';
347
  if ( count( $tracking_items ) > 0 ) {
390
  'id' => 'wc_shipment_tracking_create_nonce',
391
  'value' => wp_create_nonce( 'create-tracking-item' ),
392
  ) );
393
+ ?>
394
+ <p class="form-field tracking_number_field ">
395
+ <label for="tracking_number"><?php _e( 'Tracking number:', 'woo-advanced-shipment-tracking'); ?></label>
396
+ <input type="text" class="short" style="" name="tracking_number" id="tracking_number" value="" autocomplete="off">
397
+ </p>
398
+ <?php
399
+ /*woocommerce_wp_text_input( array(
400
  'id' => 'tracking_number',
401
  'label' => __( 'Tracking number:', 'woo-advanced-shipment-tracking' ),
402
  'placeholder' => '',
403
  'description' => '',
404
  'value' => '',
405
+ 'autofocus' => true,
406
+ ) );*/
407
 
408
  woocommerce_wp_text_input( array(
409
  'id' => 'tracking_product_code',
421
  'class' => 'date-picker-field',
422
  'value' => date_i18n( __( 'Y-m-d', 'woo-advanced-shipment-tracking' ), current_time( 'timestamp' ) ),
423
  ) );
424
+
425
+ do_action("ast_after_tracking_field", $post->ID);
426
  do_action("ast_tracking_form_between_form", $post->ID);
427
 
428
  if($wc_ast_status_partial_shipped){
578
  'tracking_product_code' => $tracking_product_code,
579
  'date_shipped' => wc_clean( $_POST['date_shipped'] ),
580
  );
581
+
582
+ $args = apply_filters( 'tracking_info_args', $args, $order_id );
583
+
584
  $tracking_item = $this->add_tracking_item( $order_id, $args );
585
 
586
+ if($_POST['change_order_to_shipped'] == 'change_order_to_shipped'){
 
587
  if('completed' == $order->get_status()){
588
  WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
589
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
622
  'tracking_product_code' => $tracking_product_code,
623
  'date_shipped' => wc_clean( $_POST['date_shipped'] ),
624
  );
625
+
626
+ $args = apply_filters( 'tracking_info_args', $args, $order_id );
627
+
628
  $tracking_item = $this->add_tracking_item( $order_id, $args );
629
+ $order = new WC_Order($order_id);
630
 
631
+ if($_POST['change_order_to_shipped'] == 'change_order_to_shipped' || $_POST['change_order_to_shipped'] == 'yes'){
632
+ if('completed' == $order->get_status()){
633
+ WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger( $order_id, $order );
634
+ $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
635
+ } else{
636
+ $order->update_status('completed');
637
+ }
638
+ } elseif($_POST['change_order_to_shipped'] == 'change_order_to_partial_shipped'){
639
+ $previous_order_status = $order->get_status();
 
 
 
 
 
 
 
 
 
 
 
 
 
640
  if('partial-shipped' == $previous_order_status){
641
  WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
642
  }
737
 
738
  if ( is_a( $email, 'WC_Email_Customer_Invoice' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_invoice']) && $wc_ast_unclude_tracking_info['show_in_customer_invoice'] == 0){
739
  return;
740
+ }
741
+
742
+ if ( is_a( $email, 'WC_Email_Customer_Note' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_note']) && $wc_ast_unclude_tracking_info['show_in_customer_note'] == 0){
743
+ return;
744
+ }
745
 
746
+ if(isset($wc_ast_unclude_tracking_info[$order_status]) && $wc_ast_unclude_tracking_info[$order_status] == 0 && !is_a( $email, 'WC_Email_Customer_Invoice' ) && !is_a( $email, 'WC_Email_Customer_Note' )){
747
  return;
748
  }
749
 
888
  public function get_formatted_tracking_item( $order_id, $tracking_item ) {
889
  $formatted = array();
890
  $tracking_items = $this->get_tracking_items( $order_id );
891
+ $trackship_supported = '';
892
  foreach($tracking_items as $key=>$item){
893
  if($item['tracking_id'] == $tracking_item['tracking_id']){
894
  $shipmet_key = $key;
1093
  $tracking_item['tracking_id'] = md5( "{$tracking_item['tracking_provider']}-{$tracking_item['tracking_number']}" . microtime() );
1094
  }
1095
 
1096
+ $tracking_item = apply_filters( 'tracking_item_args', $tracking_item, $args, $order_id );
1097
+
1098
  $tracking_items = $this->get_tracking_items( $order_id );
1099
  if($tracking_items){
1100
  $key = $this->seach_tracking_number_in_items($args['tracking_number'], $tracking_items);
1105
  }
1106
  } else{
1107
  $tracking_items[] = $tracking_item;
1108
+ }
1109
+ //echo '<pre>';print_r($tracking_items);echo '</pre>';
 
 
1110
  $this->save_tracking_items( $order_id, $tracking_items );
1111
 
1112
  $status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
1113
  $ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
1114
+ $order = new WC_Order( $order_id );
1115
+
1116
+ if( $status_shipped == 1){
1117
  if('completed' == $order->get_status()){
1118
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1119
  } else{
1123
 
1124
  if( $status_shipped == 2){
1125
  $wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
1126
+ if($wc_ast_status_partial_shipped){
 
1127
  $order->update_status('partial-shipped');
1128
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1129
  }
1130
  }
1131
 
1132
  $formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
1133
+ $tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
 
 
1134
 
1135
  // The text for the note
1136
  $note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
1199
 
1200
  $status_shipped = (isset($tracking_item["status_shipped"])?$tracking_item["status_shipped"]:"");
1201
  $ast_admin = WC_Advanced_Shipment_Tracking_Admin::get_instance();
1202
+ $order = new WC_Order( $order_id );
1203
+
1204
+ if( $status_shipped == 1){
1205
  if('completed' == $order->get_status()){
1206
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1207
  } else{
1209
  }
1210
  }
1211
 
1212
+ if( $status_shipped == 2){
 
1213
  $order->update_status('partial-shipped');
1214
  $ast_admin->trigger_woocommerce_order_status_completed( $order_id );
1215
  }
1216
+
1217
+ $formated_tracking_item = $this->get_formatted_tracking_item( $order_id, $tracking_item );
1218
+ $tracking_provider = $formated_tracking_item['formatted_tracking_provider'];
1219
+
1220
+ // The text for the note
1221
+ $note = sprintf(__("Order was shipped with %s and tracking number is: %s", 'woo-advanced-shipment-tracking'), $tracking_provider, $tracking_item['tracking_number'] );
1222
+
1223
+ // Add the note
1224
+ $order->add_order_note( $note );
1225
+
1226
  return $tracking_item;
1227
  }
1228
 
1456
  }
1457
  }
1458
 
1459
+ if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.php' ) ) {
1460
 
1461
  // search for the order by custom order number
1462
  $query_args = array(
1555
  wp_reset_postdata();
1556
  }
1557
 
1558
+ if ( is_plugin_active( 'yith-woocommerce-sequential-order-number-premium/init.php' ) ) {
1559
+ $args = array(
1560
+ 'post_type' => 'shop_order',
1561
+ 'posts_per_page' => '1',
1562
+ 'meta_query' => array(
1563
+ 'relation' => 'AND',
1564
+ array(
1565
+ 'key' => '_ywson_custom_number_order_complete',
1566
+ 'value' => $order_id
1567
+ ),
1568
+ ),
1569
+ 'post_status' => array('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-delivered', 'wc-cancelled', 'wc-refunded', 'wc-failed','wc-bit-payment') ,
1570
+ );
1571
+ $posts = get_posts( $args );
1572
+ $my_query = new WP_Query( $args );
1573
+
1574
+ if( $my_query->have_posts() ) {
1575
+ while( $my_query->have_posts()) {
1576
+ $my_query->the_post();
1577
+ if(get_the_ID()){
1578
+ $order_id = get_the_ID();
1579
+ }
1580
+ } // end while
1581
+ } // end if
1582
+ wp_reset_postdata();
1583
+ }
1584
+
1585
  return $order_id;
1586
  }
1587
 
1603
  }
1604
  }
1605
 
1606
+ if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.php' ) ) {
1607
  $custom_order_number = get_post_meta( $order_id, '_order_number_formatted', true );
1608
  if(!empty($custom_order_number)){
1609
  return $custom_order_number;
1632
  if(!empty($custom_order_number)){
1633
  return $custom_order_number;
1634
  }
1635
+ }
1636
+ if ( is_plugin_active( 'yith-woocommerce-sequential-order-number-premium/init.php' ) ) {
1637
+ $custom_order_number = get_post_meta( $order_id, '_ywson_custom_number_order_complete', true );
1638
+ if(!empty($custom_order_number)){
1639
+ return $custom_order_number;
1640
+ }
1641
+ }
1642
  }
1643
 
1644
  public function get_option_value_from_array($array,$key,$default_value){
1654
  }
1655
  return $value;
1656
  }
1657
+
1658
+ public function check_if_virtual_order($order_id){
1659
+
1660
+ $order = wc_get_order( $order_id );
1661
+
1662
+ if( is_a( $order, 'WC_Order' ) ) {
1663
+
1664
+ $order_items = $order->get_items();
1665
+
1666
+ foreach( $order_items as $order_item_id => $order_item ) {
1667
+
1668
+ $product = wc_get_product( $order_item['product_id'] );
1669
+
1670
+ if ( $order_item->get_variation_id() ) {
1671
+ if ( 'product_variation' === get_post_type( $order_item->get_variation_id() ) )
1672
+ $product = wc_get_product( $order_item->get_variation_id() );
1673
+ }
1674
+
1675
+ if( $product ) {
1676
+ if( $product->is_virtual() || $product->is_downloadable()) return true;
1677
+ }
1678
+ }
1679
+ }
1680
+ return false;
1681
+ }
1682
  }
includes/customizer/class-wc-shipped-email-customizer.php ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Customizer Setup and Custom Controls
4
+ *
5
+ */
6
+
7
+ /**
8
+ * Adds the individual sections, settings, and controls to the theme customizer
9
+ */
10
+ class wcast_shipped_customizer_email {
11
+ // Get our default values
12
+ public function __construct() {
13
+ // Get our Customizer defaults
14
+ $this->defaults = $this->wcast_generate_defaults();
15
+
16
+ // Register our sample default controls
17
+ add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
18
+
19
+ // Only proceed if this is own request.
20
+ if ( ! wcast_shipped_customizer_email::is_own_customizer_request() && ! wcast_shipped_customizer_email::is_own_preview_request() ) {
21
+ return;
22
+ }
23
+ add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_panels' ) );
24
+ // Register our sections
25
+ add_action( 'customize_register', array( wcast_customizer(), 'wcast_add_customizer_sections' ) );
26
+
27
+ // Remove unrelated components.
28
+ add_filter( 'customize_loaded_components', array( wcast_customizer(), 'remove_unrelated_components' ), 99, 2 );
29
+
30
+ // Remove unrelated sections.
31
+ add_filter( 'customize_section_active', array( wcast_customizer(), 'remove_unrelated_sections' ), 10, 2 );
32
+
33
+ // Unhook divi front end.
34
+ add_action( 'woomail_footer', array( wcast_customizer(), 'unhook_divi' ), 10 );
35
+
36
+ // Unhook Flatsome js
37
+ add_action( 'customize_preview_init', array( wcast_customizer(), 'unhook_flatsome' ), 50 );
38
+
39
+ add_filter( 'customize_controls_enqueue_scripts', array( wcast_customizer(), 'enqueue_customizer_scripts' ) );
40
+
41
+ add_action( 'parse_request', array( $this, 'set_up_preview' ) );
42
+
43
+ add_action( 'customize_preview_init', array( $this, 'enqueue_preview_scripts' ) );
44
+ }
45
+
46
+ public function enqueue_preview_scripts() {
47
+ wp_enqueue_script('wcast-email-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
48
+ wp_enqueue_style('wcast-preview-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/preview-styles.css', array(), wc_advanced_shipment_tracking()->version );
49
+ // Send variables to Javascript
50
+ $preview_id = get_theme_mod('wcast_shipped_preview_order_id');
51
+ wp_localize_script('wcast-email-preview-scripts', 'wcast_preview', array(
52
+ 'site_title' => $this->get_blogname(),
53
+ 'order_number' => $preview_id,
54
+ ));
55
+ }
56
+
57
+ /**
58
+ * Get blog name formatted for emails.
59
+ *
60
+ * @return string
61
+ */
62
+ public function get_blogname() {
63
+ return wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
64
+ }
65
+
66
+ /**
67
+ * Checks to see if we are opening our custom customizer preview
68
+ *
69
+ * @access public
70
+ * @return bool
71
+ */
72
+ public static function is_own_preview_request() {
73
+ return isset( $_REQUEST['wcast-shipped-email-customizer-preview'] ) && '1' === $_REQUEST['wcast-shipped-email-customizer-preview'];
74
+ }
75
+
76
+ /**
77
+ * Checks to see if we are opening our custom customizer controls
78
+ *
79
+ * @access public
80
+ * @return bool
81
+ */
82
+ public static function is_own_customizer_request() {
83
+ return isset( $_REQUEST['email'] ) && $_REQUEST['email'] === 'customer_shipped_email';
84
+ }
85
+
86
+ /**
87
+ * Get Customizer URL
88
+ *
89
+ */
90
+ public static function get_customizer_url($email) {
91
+ $customizer_url = add_query_arg( array(
92
+ 'wcast-customizer' => '1',
93
+ 'email' => $email,
94
+ 'url' => urlencode( add_query_arg( array( 'wcast-shipped-email-customizer-preview' => '1' ), home_url( '/' ) ) ),
95
+ 'return' => urlencode( wcast_shipped_customizer_email::get_email_settings_page_url() ),
96
+ ), admin_url( 'customize.php' ) );
97
+
98
+ return $customizer_url;
99
+ }
100
+
101
+ /**
102
+ * Get WooCommerce email settings page URL
103
+ *
104
+ * @access public
105
+ * @return string
106
+ */
107
+ public static function get_email_settings_page_url() {
108
+ return admin_url( 'admin.php?page=woocommerce-advanced-shipment-tracking' );
109
+ }
110
+
111
+ /**
112
+ * code for initialize default value for customizer
113
+ */
114
+ public function wcast_generate_defaults() {
115
+ $customizer_defaults = array(
116
+ 'wcast_shipped_email_subject' => __( 'Your {site_title} order is now shipped', 'woo-advanced-shipment-tracking' ),
117
+ 'wcast_shipped_email_heading' => __( 'Your Order is Shipped', 'woocommerce' ),
118
+ 'wcast_shipped_email_content' => __( "Hi there. we thought you'd like to know that your recent order from {site_title} has been shipped.", 'woo-advanced-shipment-tracking' ),
119
+ 'wcast_enable_shipped_email' => 'no',
120
+ );
121
+
122
+ return apply_filters( 'skyrocket_customizer_defaults', $customizer_defaults );
123
+ }
124
+
125
+ /**
126
+ * Register our sample default controls
127
+ */
128
+ public function wcast_register_sample_default_controls( $wp_customize ) {
129
+ /**
130
+ * Load all our Customizer Custom Controls
131
+ */
132
+ require_once trailingslashit( dirname(__FILE__) ) . 'custom-controls.php';
133
+
134
+ $wp_customize->add_setting( 'shipped_order_email_heading',
135
+ array(
136
+ 'default' => '',
137
+ 'transport' => 'postMessage',
138
+ 'sanitize_callback' => ''
139
+ )
140
+ );
141
+ $wp_customize->add_control( new WP_Customize_Heading_Control( $wp_customize, 'shipped_order_email_heading',
142
+ array(
143
+ 'label' => __( 'Shipped status email', 'woo-advanced-shipment-tracking' ),
144
+ 'description' => __( 'This section lets you customize the Email Content.', 'woo-advanced-shipment-tracking' ),
145
+ 'section' => 'customer_shipped_email'
146
+ )
147
+ ) );
148
+ // Display Shipment Provider image/thumbnail
149
+ $wp_customize->add_setting( 'customizer_shipped_order_settings_enabled',
150
+ array(
151
+ 'default' => $this->defaults['wcast_enable_shipped_email'],
152
+ 'transport' => 'postMessage',
153
+ 'type' => 'option',
154
+ 'sanitize_callback' => ''
155
+ )
156
+ );
157
+ $wp_customize->add_control( 'customizer_shipped_order_settings_enabled',
158
+ array(
159
+ 'label' => __( 'Enable Shipped order status email', 'woo-advanced-shipment-tracking' ),
160
+ 'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
161
+ 'section' => 'customer_shipped_email',
162
+ 'type' => 'checkbox',
163
+
164
+ )
165
+ );
166
+
167
+ // Preview Order
168
+ $wp_customize->add_setting( 'wcast_shipped_preview_order_id',
169
+ array(
170
+ 'default' => 'mockup',
171
+ 'transport' => 'refresh',
172
+ 'sanitize_callback' => ''
173
+ )
174
+ );
175
+ $wp_customize->add_control( new Skyrocket_Dropdown_Select_Custom_Control( $wp_customize, 'wcast_shipped_preview_order_id',
176
+ array(
177
+ 'label' => __( 'Preview order', 'woo-advanced-shipment-tracking' ),
178
+ 'description' => '',
179
+ 'section' => 'customer_shipped_email',
180
+ 'input_attrs' => array(
181
+ 'placeholder' => __( 'Please select a order...', 'woo-advanced-shipment-tracking' ),
182
+ 'class' => 'preview_order_select',
183
+ ),
184
+ 'choices' => wcast_customizer()->get_order_ids(),
185
+ )
186
+ ) );
187
+
188
+ // Header Text
189
+ $wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[subject]',
190
+ array(
191
+ 'default' => $this->defaults['wcast_shipped_email_subject'],
192
+ 'transport' => 'postMessage',
193
+ 'type' => 'option',
194
+ 'sanitize_callback' => ''
195
+ )
196
+ );
197
+ $wp_customize->add_control( 'woocommerce_customer_shipped_order_settings[subject]',
198
+ array(
199
+ 'label' => __( 'Subject', 'woocommerce' ),
200
+ 'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
201
+ 'section' => 'customer_shipped_email',
202
+ 'type' => 'text',
203
+ 'input_attrs' => array(
204
+ 'class' => '',
205
+ 'style' => '',
206
+ 'placeholder' => __( $this->defaults['wcast_shipped_email_subject'], 'woo-advanced-shipment-tracking' ),
207
+ ),
208
+ )
209
+ );
210
+
211
+ // Header Text
212
+ $wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[heading]',
213
+ array(
214
+ 'default' => $this->defaults['wcast_shipped_email_heading'],
215
+ 'transport' => 'postMessage',
216
+ 'type' => 'option',
217
+ 'sanitize_callback' => ''
218
+ )
219
+ );
220
+ $wp_customize->add_control( 'woocommerce_customer_shipped_order_settings[heading]',
221
+ array(
222
+ 'label' => __( 'Email heading', 'woocommerce' ),
223
+ 'description' => esc_html__( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {order_number}',
224
+ 'section' => 'customer_shipped_email',
225
+ 'type' => 'text',
226
+ 'input_attrs' => array(
227
+ 'class' => '',
228
+ 'style' => '',
229
+ 'placeholder' => __( $this->defaults['wcast_shipped_email_heading'], 'woo-advanced-shipment-tracking' ),
230
+ ),
231
+ )
232
+ );
233
+
234
+
235
+ // Test of TinyMCE control
236
+ $wp_customize->add_setting( 'woocommerce_customer_shipped_order_settings[wcast_shipped_email_content]',
237
+ array(
238
+ 'default' => $this->defaults['wcast_shipped_email_content'],
239
+ 'transport' => 'refresh',
240
+ 'sanitize_callback' => 'wp_kses_post',
241
+ 'type' => 'option',
242
+ )
243
+ );
244
+ $wp_customize->add_control( new Skyrocket_TinyMCE_Custom_control( $wp_customize, 'woocommerce_customer_shipped_order_settings[wcast_shipped_email_content]',
245
+ array(
246
+ 'label' => __( 'Email content', 'woo-advanced-shipment-tracking' ),
247
+ 'description' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ).' {site_title}, {customer_email}, {customer_first_name}, {customer_last_name}, {customer_username}, {order_number}',
248
+ 'section' => 'customer_shipped_email',
249
+ 'input_attrs' => array(
250
+ 'toolbar1' => 'bold italic bullist numlist alignleft aligncenter alignright link',
251
+ 'mediaButtons' => true,
252
+ 'placeholder' => __( $this->defaults['wcast_shipped_email_content'], 'woo-advanced-shipment-tracking' ),
253
+ )
254
+ )
255
+ ) );
256
+
257
+ $wp_customize->add_setting( 'wcast_shipped_code_block',
258
+ array(
259
+ 'default' => '',
260
+ 'transport' => 'postMessage',
261
+ 'sanitize_callback' => ''
262
+ )
263
+ );
264
+ $wp_customize->add_control( new WP_Customize_codeinfoblock_Control( $wp_customize, 'wcast_shipped_code_block',
265
+ array(
266
+ 'label' => __( 'Available variables:', 'woo-advanced-shipment-tracking' ),
267
+ 'description' => '<code>{site_title}<br>{customer_email}<br>{customer_first_name}<br>{customer_last_name}<br>{customer_company_name}<br>{customer_username}<br>{order_number}</code>',
268
+ 'section' => 'customer_shipped_email',
269
+ )
270
+ ) );
271
+ }
272
+
273
+ /**
274
+ * Set up preview
275
+ *
276
+ * @access public
277
+ * @return void
278
+ */
279
+ public function set_up_preview() {
280
+ wcast_shipped_customizer_email::is_own_preview_request();
281
+ // Make sure this is own preview request.
282
+ if ( ! wcast_shipped_customizer_email::is_own_preview_request() ) {
283
+ return;
284
+ }
285
+ include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview/shipped_preview.php';
286
+ exit;
287
+ }
288
+
289
+ /**
290
+ * code for preview of delivered order status email
291
+ */
292
+ public function preview_shipped_email(){
293
+ // Load WooCommerce emails.
294
+ $wc_emails = WC_Emails::instance();
295
+ $emails = $wc_emails->get_emails();
296
+ $preview_id = get_theme_mod('wcast_shipped_preview_order_id');
297
+
298
+ if($preview_id == '' || $preview_id == 'mockup') {
299
+ $content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
300
+ echo $content;
301
+ return;
302
+ }
303
+
304
+ $order = wc_get_order( $preview_id );
305
+
306
+ if(!$order){
307
+ $content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select order to preview.', 'woo-advanced-shipment-tracking' ) . '</div>';
308
+ echo $content;
309
+ return;
310
+ }
311
+
312
+ $email_type = 'WC_Email_Customer_Shipped_Order';
313
+
314
+ if ( false === $email_type ) {
315
+ return false;
316
+ }
317
+
318
+
319
+
320
+ // Reference email.
321
+ if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
322
+ $email = $emails[ $email_type ];
323
+ }
324
+ $order_status = 'partial-shipped';
325
+ // Get an order
326
+ $order = self::get_wc_order_for_preview( $order_status, $preview_id );
327
+
328
+ // Make sure gateways are running in case the email needs to input content from them.
329
+ WC()->payment_gateways();
330
+ // Make sure shipping is running in case the email needs to input content from it.
331
+ WC()->shipping();
332
+
333
+ $email->object = $order;
334
+ $email->find['order-date'] = '{order_date}';
335
+ $email->find['order-number'] = '{order_number}';
336
+ if ( is_object( $order ) ) {
337
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
338
+ $email->replace['order-number'] = $email->object->get_order_number();
339
+ // Other properties
340
+ $email->recipient = $email->object->get_billing_email();
341
+ }
342
+
343
+ // Get email content and apply styles.
344
+ $content = $email->get_content();
345
+
346
+ $content = $email->style_inline( $content );
347
+ $content = apply_filters( 'woocommerce_mail_content', $content );
348
+
349
+ echo $content;
350
+ }
351
+
352
+ /**
353
+ * Get WooCommerce order for preview
354
+ *
355
+ * @access public
356
+ * @param string $order_status
357
+ * @return object
358
+ */
359
+ public static function get_wc_order_for_preview( $order_status = null, $order_id = null ) {
360
+ if ( ! empty( $order_id ) && 'mockup' != $order_id ) {
361
+ return wc_get_order( $order_id );
362
+ } else {
363
+ // Use mockup order
364
+
365
+ // Instantiate order object
366
+ $order = new WC_Order();
367
+
368
+ // Other order properties
369
+ $order->set_props( array(
370
+ 'id' => 1,
371
+ 'status' => ( null === $order_status ? 'processing' : $order_status ),
372
+ 'billing_first_name' => 'Sherlock',
373
+ 'billing_last_name' => 'Holmes',
374
+ 'billing_company' => 'Detectives Ltd.',
375
+ 'billing_address_1' => '221B Baker Street',
376
+ 'billing_city' => 'London',
377
+ 'billing_postcode' => 'NW1 6XE',
378
+ 'billing_country' => 'GB',
379
+ 'billing_email' => 'sherlock@holmes.co.uk',
380
+ 'billing_phone' => '02079304832',
381
+ 'date_created' => date( 'Y-m-d H:i:s' ),
382
+ 'total' => 24.90,
383
+ ) );
384
+
385
+ // Item #1
386
+ $order_item = new WC_Order_Item_Product();
387
+ $order_item->set_props( array(
388
+ 'name' => 'A Study in Scarlet',
389
+ 'subtotal' => '9.95',
390
+ 'sku' => 'kwd_ex_1',
391
+ ) );
392
+ $order->add_item( $order_item );
393
+
394
+ // Item #2
395
+ $order_item = new WC_Order_Item_Product();
396
+ $order_item->set_props( array(
397
+ 'name' => 'The Hound of the Baskervilles',
398
+ 'subtotal' => '14.95',
399
+ 'sku' => 'kwd_ex_2',
400
+ ) );
401
+ $order->add_item( $order_item );
402
+
403
+ // Return mockup order
404
+ return $order;
405
+ }
406
+
407
+ }
408
+ }
409
+ /**
410
+ * Initialise our Customizer settings
411
+ */
412
+
413
+ $wcast_shipped_customizer_settings = new wcast_shipped_customizer_email();
414
+ add_action( 'customize_save_customizer_shipped_order_settings_enabled', 'woocommerce_customer_shipped_order_settings_fun', 100, 1 );
415
+
416
+ /**
417
+ * Update Delivered order email enable/disable
418
+ *
419
+ */
420
+ function woocommerce_customer_shipped_order_settings_fun($data){
421
+ $post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
422
+ $shipped_order_settings = get_option( 'woocommerce_customer_shipped_order_settings');
423
+
424
+ if(isset($post_values['customizer_shipped_order_settings_enabled']) && ($post_values['customizer_shipped_order_settings_enabled'] == 1)){
425
+ $shipped_order_settings['enabled'] = 'yes';
426
+ } else{
427
+ $shipped_order_settings['enabled'] = 'no';
428
+ }
429
+ update_option( 'woocommerce_customer_shipped_order_settings',$shipped_order_settings);
430
+ }
includes/customizer/class-wcast-customizer.php CHANGED
@@ -104,7 +104,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
104
  'description' => '',
105
  'panel' => 'wcast_naviation_panel'
106
  )
107
- );
108
 
109
  $wp_customize->add_section( 'customer_delivered_email',
110
  array(
@@ -113,7 +113,13 @@ class WC_Advanced_Shipment_Tracking_Customizer {
113
  'panel' => 'wcast_naviation_panel'
114
  )
115
  );
116
-
 
 
 
 
 
 
117
  $wp_customize->add_section( 'customer_partial_shipped_email',
118
  array(
119
  'title' => __( 'Partially Shipped status email', 'woo-advanced-shipment-tracking' ),
@@ -208,6 +214,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
208
  'ajax_url' => admin_url('admin-ajax.php'),
209
  'email_preview_url' => $this->get_email_preview_url(),
210
  'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
 
211
  'updated_tracking_email_preview_url' => $this->get_updated_tracking_email_preview_url(),
212
  'tracking_preview_url' => $this->get_tracking_preview_url(),
213
  'customer_failure_preview_url' => $this->get_customer_failure_preview_url(),
@@ -247,6 +254,18 @@ class WC_Advanced_Shipment_Tracking_Customizer {
247
  return $email_preview_url;
248
  }
249
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  /**
251
  * Get Customizer URL
252
  *
@@ -430,7 +449,7 @@ class WC_Advanced_Shipment_Tracking_Customizer {
430
  */
431
  public static function is_own_section( $key ) {
432
 
433
- if ($key === 'wcast_naviation_panel' || $key === 'ast_tracking_general_section' || $key === 'ast_tracking_per_item' || $key === 'ast_tracking_simple_section' || $key === 'ast_tracking_table_section' || $key === 'default_controls_section' || $key === 'tracking_page_section' || $key === 'customer_delivered_email' || $key === 'customer_partial_shipped_email' || $key === 'customer_updated_tracking_email' || $key === 'customer_failure_email' || $key === 'customer_intransit_email' || $key === 'customer_outfordelivery_email' || $key === 'customer_delivered_status_email' || $key === 'customer_returntosender_email' || $key === 'customer_availableforpickup_email' || $key === 'admin_late_shipments_email') {
434
  return true;
435
  }
436
 
104
  'description' => '',
105
  'panel' => 'wcast_naviation_panel'
106
  )
107
+ );
108
 
109
  $wp_customize->add_section( 'customer_delivered_email',
110
  array(
113
  'panel' => 'wcast_naviation_panel'
114
  )
115
  );
116
+ $wp_customize->add_section( 'customer_custom_completed_email',
117
+ array(
118
+ 'title' => __( 'Completed order status email', 'woo-advanced-shipment-tracking' ),
119
+ 'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
120
+ 'panel' => 'wcast_naviation_panel'
121
+ )
122
+ );
123
  $wp_customize->add_section( 'customer_partial_shipped_email',
124
  array(
125
  'title' => __( 'Partially Shipped status email', 'woo-advanced-shipment-tracking' ),
214
  'ajax_url' => admin_url('admin-ajax.php'),
215
  'email_preview_url' => $this->get_email_preview_url(),
216
  'partial_shipped_email_preview_url' => $this->get_partial_shipped_email_preview_url(),
217
+ 'custom_completed_email_preview_url' => $this->get_custom_completed_email_preview_url(),
218
  'updated_tracking_email_preview_url' => $this->get_updated_tracking_email_preview_url(),
219
  'tracking_preview_url' => $this->get_tracking_preview_url(),
220
  'customer_failure_preview_url' => $this->get_customer_failure_preview_url(),
254
  return $email_preview_url;
255
  }
256
 
257
+ /**
258
+ * Get Customizer URL
259
+ *
260
+ */
261
+ public static function get_custom_completed_email_preview_url() {
262
+ $email_preview_url = add_query_arg( array(
263
+ 'wcast-custom-completed-email-customizer-preview' => '1',
264
+ ), home_url( '' ) );
265
+
266
+ return $email_preview_url;
267
+ }
268
+
269
  /**
270
  * Get Customizer URL
271
  *
449
  */
450
  public static function is_own_section( $key ) {
451
 
452
+ if ($key === 'wcast_naviation_panel' || $key === 'ast_tracking_general_section' || $key === 'ast_tracking_per_item' || $key === 'ast_tracking_simple_section' || $key === 'ast_tracking_table_section' || $key === 'default_controls_section' || $key === 'tracking_page_section' || $key === 'customer_delivered_email' || $key === 'customer_custom_completed_email' || $key === 'customer_partial_shipped_email' || $key === 'customer_shipped_email' || $key === 'customer_updated_tracking_email' || $key === 'customer_failure_email' || $key === 'customer_intransit_email' || $key === 'customer_outfordelivery_email' || $key === 'customer_delivered_status_email' || $key === 'customer_returntosender_email' || $key === 'customer_availableforpickup_email' || $key === 'admin_late_shipments_email') {
453
  return true;
454
  }
455
 
includes/customizer/preview/shipped_preview.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if (!defined('ABSPATH')) {
4
+ exit;
5
+ }
6
+
7
+ ?>
8
+
9
+ <head>
10
+
11
+ <meta charset="<?php bloginfo('charset'); ?>" />
12
+ <meta name="viewport" content="width=device-width" />
13
+ <style type="text/css" id="ast_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
14
+ </head>
15
+
16
+ <body class="ast_preview_body">
17
+ <div id="overlay"></div>
18
+ <div id="ast_preview_wrapper" style="display: block;">
19
+
20
+ <?php wcast_shipped_customizer_email::preview_shipped_email(); ?>
21
+
22
+ </div>
23
+
24
+ <?php
25
+ do_action( 'woomail_footer' );
26
+ wp_footer(); ?>
27
+
28
+ </body>
29
+
30
+ </html>
includes/email-manager.php CHANGED
@@ -32,7 +32,7 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
32
 
33
  if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
34
  $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
35
- }
36
  return $emails;
37
  }
38
 
32
 
33
  if ( ! isset( $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] ) ) {
34
  $emails[ 'WC_Email_Customer_Updated_Tracking_Order' ] = include_once( 'emails/class-shipment-updated-tracking-email.php' );
35
+ }
36
  return $emails;
37
  }
38
 
includes/emails/class-shipment-delivered-email.php CHANGED
@@ -136,14 +136,13 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
136
  //ob_start();
137
  $woocommerce_customer_delivered_order_settings = get_option('woocommerce_customer_delivered_order_settings');
138
 
 
139
  $email_content = $ast->get_option_value_from_array('woocommerce_customer_delivered_order_settings','wcast_delivered_email_content',$wcast_initialise_customizer_email->defaults['wcast_delivered_email_content']);
140
 
141
  $wcast_show_tracking_details = $woocommerce_customer_delivered_order_settings['wcast_show_tracking_details'];
142
  $wcast_show_order_details = $woocommerce_customer_delivered_order_settings['wcast_show_order_details'];
143
  $wcast_show_billing_address = $woocommerce_customer_delivered_order_settings['wcast_show_billing_address'];
144
- $wcast_show_shipping_address = $woocommerce_customer_delivered_order_settings['wcast_show_shipping_address'];
145
-
146
-
147
 
148
  $message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
149
 
@@ -223,13 +222,13 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
223
  ob_start();
224
  do_action( 'wcast_email_after_email_content', $order, $sent_to_admin, $plain_text, $this );
225
  $message .= ob_get_clean();
 
226
  // create a new email
227
  $email = new WC_Email();
228
  $email->id = 'WC_Delivered_email';
229
 
230
  // wrap the content with the email template and then add styles
231
- $message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
232
-
233
  return $message;
234
  }
235
  }
136
  //ob_start();
137
  $woocommerce_customer_delivered_order_settings = get_option('woocommerce_customer_delivered_order_settings');
138
 
139
+
140
  $email_content = $ast->get_option_value_from_array('woocommerce_customer_delivered_order_settings','wcast_delivered_email_content',$wcast_initialise_customizer_email->defaults['wcast_delivered_email_content']);
141
 
142
  $wcast_show_tracking_details = $woocommerce_customer_delivered_order_settings['wcast_show_tracking_details'];
143
  $wcast_show_order_details = $woocommerce_customer_delivered_order_settings['wcast_show_order_details'];
144
  $wcast_show_billing_address = $woocommerce_customer_delivered_order_settings['wcast_show_billing_address'];
145
+ $wcast_show_shipping_address = $woocommerce_customer_delivered_order_settings['wcast_show_shipping_address'];
 
 
146
 
147
  $message = wc_advanced_shipment_tracking_email_class()->email_content($email_content,$order_id,$order);
148
 
222
  ob_start();
223
  do_action( 'wcast_email_after_email_content', $order, $sent_to_admin, $plain_text, $this );
224
  $message .= ob_get_clean();
225
+
226
  // create a new email
227
  $email = new WC_Email();
228
  $email->id = 'WC_Delivered_email';
229
 
230
  // wrap the content with the email template and then add styles
231
+ $message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
 
232
  return $message;
233
  }
234
  }
includes/views/admin_options_addons.php CHANGED
@@ -176,7 +176,8 @@
176
  </tbody>
177
  </table>
178
  </div>
179
- </div>
 
180
  </form>
181
  </div>
182
  <?php include 'zorem_admin_addons_sidebar.php'; ?>
176
  </tbody>
177
  </table>
178
  </div>
179
+ </div>
180
+ <?php do_action('ast_addons_section_html');?>
181
  </form>
182
  </div>
183
  <?php include 'zorem_admin_addons_sidebar.php'; ?>
includes/views/admin_options_settings.php CHANGED
@@ -61,14 +61,13 @@
61
  <tbody>
62
  <tr valign="top">
63
  <td>
64
- <h3 style=""><?php _e( 'Custom Order Statuses', 'woo-advanced-shipment-tracking' ); ?></h3>
65
  </td>
66
  </tr>
67
  </tbody>
68
- </table>
69
-
70
  <table class="form-table order-status-table">
71
- <tbody>
72
  <tr valign="top" class="<?php if(!get_option('wc_ast_status_delivered')){echo 'disable_row'; } ?>">
73
  <td class="forminp" style="width: 30px;">
74
  <span class="mdl-list__item-secondary-action">
@@ -193,7 +192,8 @@
193
  <a class='settings_edit' href="<?php echo wcast_initialise_customizer_email::get_customizer_url('customer_updated_tracking_email'); ?>"><?php _e( 'Edit', 'woocommerce' ) ?></a>
194
  </fieldset>
195
  </td>
196
- </tr>
 
197
  </tbody>
198
  </table>
199
  <table class="form-table">
61
  <tbody>
62
  <tr valign="top">
63
  <td>
64
+ <h3 style=""><?php _e( 'Order Statuses', 'woo-advanced-shipment-tracking' ); ?></h3>
65
  </td>
66
  </tr>
67
  </tbody>
68
+ </table>
 
69
  <table class="form-table order-status-table">
70
+ <tbody>
71
  <tr valign="top" class="<?php if(!get_option('wc_ast_status_delivered')){echo 'disable_row'; } ?>">
72
  <td class="forminp" style="width: 30px;">
73
  <span class="mdl-list__item-secondary-action">
192
  <a class='settings_edit' href="<?php echo wcast_initialise_customizer_email::get_customizer_url('customer_updated_tracking_email'); ?>"><?php _e( 'Edit', 'woocommerce' ) ?></a>
193
  </fieldset>
194
  </td>
195
+ </tr>
196
+ <?php do_action("ast_orders_status_column_end"); ?>
197
  </tbody>
198
  </table>
199
  <table class="form-table">
includes/views/admin_trackship_dashboard.php CHANGED
@@ -14,7 +14,7 @@
14
  <th scope="row" class="titledesc"><label><?php _e( 'Connection Status', 'woo-advanced-shipment-tracking' ); ?></label></th>
15
  <td class="forminp">
16
  <fieldset>
17
- <a href="https://my.trackship.info/?utm_source=wpadmin&utm_medium=sidebar&utm_campaign=upgrade" target="_blank" class="api_connected"><?php _e( 'Connected', 'woo-advanced-shipment-tracking' ); ?><span class="dashicons dashicons-yes"></span></a>
18
  </fieldset>
19
  </td>
20
  </tr>
@@ -36,8 +36,8 @@
36
  </tr>
37
  <tr valign="top">
38
  <td colspan="2">
39
- <a href="https://trackship.info/documentation/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=docs" class="" style="margin-right: 10px;" target="blank"><?php _e( 'Documentation', 'woo-advanced-shipment-tracking' ); ?></a>
40
- <a href="https://my.trackship.info/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=dashboard" class="" target="blank"><?php _e( 'TrackShip Dashboard', 'woo-advanced-shipment-tracking' ); ?></a>
41
  </td>
42
  </tr>
43
  </tbody>
14
  <th scope="row" class="titledesc"><label><?php _e( 'Connection Status', 'woo-advanced-shipment-tracking' ); ?></label></th>
15
  <td class="forminp">
16
  <fieldset>
17
+ <a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=sidebar&utm_campaign=upgrade" target="_blank" class="api_connected"><?php _e( 'Connected', 'woo-advanced-shipment-tracking' ); ?><span class="dashicons dashicons-yes"></span></a>
18
  </fieldset>
19
  </td>
20
  </tr>
36
  </tr>
37
  <tr valign="top">
38
  <td colspan="2">
39
+ <a href="https://trackship.info/docs/overview/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=docs" class="" style="margin-right: 10px;" target="blank"><?php _e( 'Documentation', 'woo-advanced-shipment-tracking' ); ?></a>
40
+ <a href="https://trackship.info/my-account/?utm_source=wpadmin&utm_medium=ts_settings&utm_campaign=dashboard" class="" target="blank"><?php _e( 'TrackShip Dashboard', 'woo-advanced-shipment-tracking' ); ?></a>
41
  </td>
42
  </tr>
43
  </tbody>
readme.txt CHANGED
@@ -96,10 +96,15 @@ USPS, ePacket, Delhivery, Yun Express Tracking, UPS, Australia Post, FedEx, Aram
96
  * [Booster for WooCommerce](https://wordpress.org/plugins/woocommerce-jetpack/)
97
  * [WP-Lister Pro for Amazon](https://www.wplab.com/plugins/wp-lister-for-amazon/)
98
 
99
- = Compatibility with PDF Invoices & Packing Slips plugins =
100
  * [WooCommerce PDF Invoices & Packing Slips plugin](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips)
101
  * [DHL for WooCommerce](https://wordpress.org/plugins/dhl-for-woocommerce/)
 
 
102
  * [ShipWorks Connector for WordPress](https://wordpress.org/plugins/shipworks-e-commerce-bridge/)
 
 
 
103
 
104
  = Compatibility with SMS Plugins =
105
  * [SMS Alert Order Notifications – WooCommerce](https://wordpress.org/plugins/sms-alert/)
@@ -156,10 +161,38 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
156
 
157
  == Changelog ==
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  = 2.9.9.3 =
160
  * Dev - Limit get orders to 100 on TrackShip tools page
161
  * Fix - version 2.9.8 rollback
162
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  = 2.9.8 =
164
  * Fix - fixed issue so trackship_supported column adding in shipping providers table and based on that use carrier website as tracking link if TrackShip not sot supported
165
 
@@ -219,59 +252,4 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
219
  * Enhancement - Redesign Shipment Tracking Customizer
220
  * Fix - Fixed issue in tracking display customizer table background-color
221
 
222
- = 2.8.9 =
223
- * Enhancement - Add editable text for simple layout in tracking info customizer
224
- * Dev - Added Rest API v3
225
- * Localization - Updated language translation files
226
- * Fix - undefined variable $tracking_info_settings in emails/plain/tracking-info.php
227
- * Fix - Fixed issue in WooCommerce app - unable to fetch Shipping providers
228
-
229
- = 2.8.8 =
230
- * Enhancement - Added "Date" in simple layout tracking display format
231
- * Enhancement - Updated date format for bulk import from dd-mm-YYYY to dd/mm/YYYY
232
- * Dev - Added missing plain email template tracking-info.php
233
- * Dev - Updated sample csv file for bulk import
234
-
235
- = 2.8.7 =
236
- * Dev - Added compatibility with WooCommerce 4.0
237
- * Dev - Added compatibility with WPML
238
- * Dev - Migrate customizer data from theme_mode to option
239
- * Fix - Undefined index: date_shipped in woo-advanced-shipment-tracking/includes/api/v1/class-wc-advanced-shipment-tracking-rest-api-controller.php on line 520
240
- * Fix - Undefined index: date_shipped in woo-advanced-shipment-tracking/templates/emails/tracking-info.php on line 259
241
- * Fix - Undefined variable: th_column_style in woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php on line 827
242
-
243
- = 2.8.6 =
244
- * Localization - Added language support for Dutch / Nederlands
245
- * Enhancement - Added functionality for Late Shipment admin nitifactions
246
- * Enhancement - Added option for choose date format for CSV import
247
- * Dev - Added hook in orders details email template - 'wcast_email_before_order_table' and 'wcast_email_after_order_table'
248
- * Dev - Updated TrackShip status emails logic - if the shipment status changes to one of the tracking numbers, send only this tracking number in the email notification
249
- * Fix - validation issue in shippment tracking page
250
-
251
- = 2.8.5 =
252
- * Dev - If custom provider has no tracking link remove url from tracking number
253
- * Fix - Fixed issue with tracking page in settings, display save button when trackship tracking page disable
254
- * Fix - Fixed error with kadence customizer in completed email
255
-
256
- = 2.8.4 =
257
- * Dev - Updated licensing system for AST Tracking Per Item Add-on
258
-
259
- = 2.8.3 =
260
- * Fix - Fixed error 'Call to undefined function SMSWOO()' in settings page
261
-
262
- = 2.8.2 =
263
- * Dev - Added compatibility with Sequential Order Numbers Pro
264
- * Enhancement - Added Indonesian shipping carriers
265
- * Enhancement - Added SMS for WooCommerce section in Add-ons tab in settings
266
- * Fix - Fixed issue with tracking url '&#038' in custom shipping provider
267
-
268
- = 2.8.1 =
269
- * Enhancement - Updated New Zealand Post and CourierPost shipping provider image
270
- * Enhancement - Added success admin notice for review
271
-
272
- = 2.8 =
273
- * Dev - Added functionality for Bulk import tracking info per item for Tracking Per Item Addon
274
- * Dev - Added functionality for add tracking info per item for Tracking Per Item Addon
275
- * Enhancement - Updated New Zealand Post shipment provider logo
276
-
277
  [For the complete changelog](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/changelog/)
96
  * [Booster for WooCommerce](https://wordpress.org/plugins/woocommerce-jetpack/)
97
  * [WP-Lister Pro for Amazon](https://www.wplab.com/plugins/wp-lister-for-amazon/)
98
 
99
+ = Compatibility with PDF Invoices plugins =
100
  * [WooCommerce PDF Invoices & Packing Slips plugin](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips)
101
  * [DHL for WooCommerce](https://wordpress.org/plugins/dhl-for-woocommerce/)
102
+
103
+ = Compatibility with Shipping Labels Plugins =
104
  * [ShipWorks Connector for WordPress](https://wordpress.org/plugins/shipworks-e-commerce-bridge/)
105
+ * [WooCommerce ShipStation Gateway](https://wordpress.org/plugins/woocommerce-shipstation-integration/)
106
+ * [WooCommerce Shipping Services](https://wordpress.org/plugins/woocommerce-services/)
107
+ * [WooCommerce UPS Shipping Plugin with Print Label](https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/)
108
 
109
  = Compatibility with SMS Plugins =
110
  * [SMS Alert Order Notifications – WooCommerce](https://wordpress.org/plugins/sms-alert/)
161
 
162
  == Changelog ==
163
 
164
+ = 2.9.9.5 =
165
+ * Enhancement - Update TrackShip link on WordPress dashboard and on the AST settings page
166
+ * Fix - Responsive issue of the shipping provider list
167
+ * Enhancement - Added shipping providers filter dropdown in the orders page
168
+ * Fix - Fixed warning - Undefined variable: trackship_supported in plugins/woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php on line 1056
169
+ * Dev - Remove query SHOW TABLES LIKE 'wp\\_shipment\\_batch\\_process'
170
+ * Dev - Added compatibility with Yith custom order numbers plugin
171
+ * Enhancement - Added option for remove tracking info from Customer note emails
172
+
173
+ = 2.9.9.4 =
174
+ * Enhancement - Added new option for create new order status shipped not just rename, so user can use completed and shipped both order status for virtual orders and Local Pickup shipping method
175
+ * Enhancement - Set tracking number field focus on orders ans single order page
176
+ * Enhancement Change tracking_number input field name- Update TrackShip link on WordPress dashboard and on the AST settings page
177
+ * Dev - Limit get orders to 100 on TrackShip tools page
178
+ * Dev - Fix slow load issue of WordPress dashboard because of TrckShip Analytics dashboard
179
+
180
  = 2.9.9.3 =
181
  * Dev - Limit get orders to 100 on TrackShip tools page
182
  * Fix - version 2.9.8 rollback
183
 
184
+ = 2.9.9.2 =
185
+ * Fix - Fatal error: Uncaught Error: Call to a member function get() on null in /home/jh1ua38qa95m/public_html/store/wp-includes/query.php:28 Stack trace: woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking-settings.php(444)
186
+
187
+ = 2.9.9.1 =
188
+ * Fix - Fatal error: Uncaught Error: Call to a member function get_items() on bool in woo-advanced-shipment-tracking/includes/class-wc-advanced-shipment-tracking.php:328
189
+
190
+ = 2.9.9 =
191
+ * Enhancement - Added new option for create new order status shipped not just rename, so user can use completed and shipped both order status for virtual orders and Local Pickup shipping method
192
+ * Enhancement - Set tracking number field focus on orders ans single order page
193
+ * Enhancement - Update TrackShip link on WordPress dashboard and on the AST settings page
194
+ * Dev - Limit get orders to 100 on TrackShip tools page
195
+
196
  = 2.9.8 =
197
  * Fix - fixed issue so trackship_supported column adding in shipping providers table and based on that use carrier website as tracking link if TrackShip not sot supported
198
 
252
  * Enhancement - Redesign Shipment Tracking Customizer
253
  * Fix - Fixed issue in tracking display customizer table background-color
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  [For the complete changelog](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking/changelog/)
templates/emails/customer-shipped-order.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Customer shipped order email
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-shipped-order.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates/Emails
15
+ * @version 3.7.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+ $wcast_shipped_customizer_settings = new wcast_shipped_customizer_email();
22
+
23
+ $ast = new WC_Advanced_Shipment_Tracking_Actions;
24
+ $email_content = $ast->get_option_value_from_array('woocommerce_customer_shipped_order_settings','wcast_shipped_email_content',$wcast_shipped_customizer_settings->defaults['wcast_shipped_email_content']);
25
+
26
+ $email_content = str_replace( '{customer_email}', $order->get_billing_email(), $email_content );
27
+ $email_content = str_replace( '{site_title}', $wcast_shipped_customizer_settings->get_blogname(), $email_content );
28
+ $email_content = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $email_content );
29
+ $email_content = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $email_content );
30
+
31
+ if($order->get_billing_company()){
32
+ $email_content = str_replace( '{customer_company_name}', $order->get_billing_company(), $email_content );
33
+ } else{
34
+ $email_content = str_replace( '{customer_company_name}','', $email_content );
35
+ }
36
+
37
+ $user = $order->get_user();
38
+ if($user){
39
+ $username = $user->user_login;
40
+ }
41
+ if(isset($username)){
42
+ $email_content = str_replace( '{customer_username}', $username, $email_content );
43
+ } else{
44
+ $email_content = str_replace( '{customer_username}', '', $email_content );
45
+ }
46
+ $email_content = str_replace( '{order_number}', $order->get_id(), $email_content );
47
+ /*
48
+ * @hooked WC_Emails::email_header() Output the email header
49
+ */
50
+ do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
51
+
52
+ <?php /* translators: %s: Site title */ ?>
53
+ <p class="shipped_email_content"><?php echo $email_content; ?></p>
54
+ <?php
55
+
56
+ /*
57
+ * @hooked WC_Emails::order_details() Shows the order details table.
58
+ * @hooked WC_Structured_Data::generate_order_data() Generates structured data.
59
+ * @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
60
+ * @since 2.5.0
61
+ */
62
+ do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
63
+
64
+ /*
65
+ * @hooked WC_Emails::order_meta() Shows order meta data.
66
+ */
67
+ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
68
+
69
+ /*
70
+ * @hooked WC_Emails::customer_details() Shows customer details
71
+ * @hooked WC_Emails::email_address() Shows email address
72
+ */
73
+ do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
74
+
75
+ /**
76
+ * Show user-defined additonal content - this is set in each email's settings.
77
+ */
78
+ if ( $additional_content ) {
79
+ echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
80
+ }
81
+
82
+ /*
83
+ * @hooked WC_Emails::email_footer() Output the email footer
84
+ */
85
+ do_action( 'woocommerce_email_footer', $email );
templates/emails/tracking-info.php CHANGED
@@ -33,7 +33,7 @@ if ( $tracking_items ) :
33
  $tracking_info_settings = get_option('tracking_info_settings');
34
  $ast = new WC_Advanced_Shipment_Tracking_Actions;
35
 
36
- $select_tracking_template = $tracking_info_settings['select_tracking_template'];
37
 
38
  $show_provider_th = 1;
39
  $colspan = 1;
@@ -71,9 +71,9 @@ if ( $tracking_items ) :
71
 
72
  $email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
73
 
74
- if($tracking_info_settings['header_text_change']){ $shipment_tracking_header = $tracking_info_settings['header_text_change']; } else{ $shipment_tracking_header = "Tracking Information"; }
75
 
76
- if($tracking_info_settings['additional_header_text']){ $shipment_tracking_header_text = $tracking_info_settings['additional_header_text']; }
77
 
78
  $email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
79
 
@@ -93,7 +93,7 @@ if ( $tracking_items ) :
93
 
94
  $tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color',$wcast_customizer_settings->defaults['tracking_link_bg_color']);
95
 
96
- if($tracking_info_settings['tracking_link_border']){
97
  $tracking_link_border = 'underline';
98
  } else{
99
  $tracking_link_border = 'unset';
@@ -168,7 +168,7 @@ if ( $tracking_items ) :
168
 
169
  $simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
170
 
171
- $tracking_number_link = '<a href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
172
 
173
  $simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
174
 
33
  $tracking_info_settings = get_option('tracking_info_settings');
34
  $ast = new WC_Advanced_Shipment_Tracking_Actions;
35
 
36
+ $select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template',$wcast_customizer_settings->defaults['select_tracking_template']);
37
 
38
  $show_provider_th = 1;
39
  $colspan = 1;
71
 
72
  $email_border_size = $ast->get_option_value_from_array('tracking_info_settings','table_border_size',$wcast_customizer_settings->defaults['table_border_size']);
73
 
74
+ $shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
75
 
76
+ $shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
77
 
78
  $email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
79
 
93
 
94
  $tracking_link_bg_color = $ast->get_option_value_from_array('tracking_info_settings','tracking_link_bg_color',$wcast_customizer_settings->defaults['tracking_link_bg_color']);
95
 
96
+ if(isset($tracking_info_settings['tracking_link_border'])){
97
  $tracking_link_border = 'underline';
98
  } else{
99
  $tracking_link_border = 'unset';
168
 
169
  $simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
170
 
171
+ $tracking_number_link = '<a target="_blank" href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
172
 
173
  $simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
174
 
templates/myaccount/tracking-info.php CHANGED
@@ -31,8 +31,8 @@ if ( $tracking_items ) :
31
  $ast = new WC_Advanced_Shipment_Tracking_Actions;
32
 
33
  $tracking_info_settings = get_option('tracking_info_settings');
34
-
35
- $select_tracking_template = $tracking_info_settings['select_tracking_template'];
36
 
37
  $show_provider_th = 1;
38
  $colspan = 1;
@@ -64,9 +64,9 @@ if ( $tracking_items ) :
64
 
65
  if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
66
 
67
- if($tracking_info_settings['header_text_change']){ $shipment_tracking_header = $tracking_info_settings['header_text_change']; } else{ $shipment_tracking_header = "Tracking Information"; }
68
 
69
- if($tracking_info_settings['additional_header_text']){ $shipment_tracking_header_text = $tracking_info_settings['additional_header_text']; }
70
 
71
  $email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
72
 
@@ -146,7 +146,7 @@ if ( $tracking_items ) :
146
 
147
  $simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
148
 
149
- $tracking_number_link = '<a href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
150
 
151
  $simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
152
 
31
  $ast = new WC_Advanced_Shipment_Tracking_Actions;
32
 
33
  $tracking_info_settings = get_option('tracking_info_settings');
34
+
35
+ $select_tracking_template = $ast->get_option_value_from_array('tracking_info_settings','select_tracking_template',$wcast_customizer_settings->defaults['select_tracking_template']);
36
 
37
  $show_provider_th = 1;
38
  $colspan = 1;
64
 
65
  if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
66
 
67
+ $shipment_tracking_header = $ast->get_option_value_from_array('tracking_info_settings','header_text_change','Tracking Information');
68
 
69
+ $shipment_tracking_header_text = $ast->get_option_value_from_array('tracking_info_settings','additional_header_text','');
70
 
71
  $email_table_backgroud_color = $ast->get_option_value_from_array('tracking_info_settings','table_bg_color',$wcast_customizer_settings->defaults['table_bg_color']);
72
 
146
 
147
  $simple_layout_content_updated = str_replace('{shipping_provider}',$formatted_tracking_provider,$simple_layout_content_updated);
148
 
149
+ $tracking_number_link = '<a target="_blank" href="'.esc_url( $url ).'">'.$tracking_item['tracking_number'].'</a>';
150
 
151
  $simple_layout_content_updated = str_replace('{tracking_number_link}',$tracking_number_link,$simple_layout_content_updated);
152
 
woocommerce-advanced-shipment-tracking.php CHANGED
@@ -4,14 +4,14 @@
4
  * Plugin Name: Advanced Shipment Tracking for WooCommerce
5
  * Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
6
  * Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
7
- * Version: 2.9.9.3
8
  * Author: zorem
9
  * Author URI: https://www.zorem.com
10
  * License: GPL-2.0+
11
  * License URI:
12
  * Text Domain: woo-advanced-shipment-tracking
13
  * Domain Path: /lang/
14
- * WC tested up to: 4.0
15
  */
16
 
17
 
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
22
  *
23
  * @var string
24
  */
25
- public $version = '2.9.9.3';
26
 
27
  /**
28
  * Initialize the main plugin function
@@ -166,8 +166,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
166
  add_action("fix_shipment_tracking_for_deleted_tracking", array( $this->actions, 'func_fix_shipment_tracking_for_deleted_tracking' ), 10, 3 );
167
 
168
  add_action('admin_footer', array( $this->actions, 'custom_validation_js'));
169
-
170
- //add_action('admin_footer', array( $this->actions, 'add_inline_tracking_lightbox'));
171
  add_action( 'wp_ajax_add_inline_tracking_number', array( $this->actions, 'save_inline_tracking_number' ) );
172
 
173
  //load css js
@@ -184,11 +183,11 @@ class zorem_woocommerce_advanced_shipment_tracking {
184
 
185
  $wc_ast_status_delivered = get_option('wc_ast_status_delivered');
186
  if($wc_ast_status_delivered == 1)
187
- add_action( 'woocommerce_order_status_delivered', array( $this, 'email_trigger_delivered' ), 10, 2 );
188
 
189
  $wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
190
  if($wc_ast_status_partial_shipped == 1)
191
- add_action( 'woocommerce_order_status_partial-shipped', array( $this, 'email_trigger_partial_shipped' ), 10, 2 );
192
 
193
  $wc_ast_status_updated_tracking = get_option('wc_ast_status_updated_tracking');
194
  if($wc_ast_status_updated_tracking == 1)
@@ -214,7 +213,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
214
  public function email_trigger_partial_shipped($order_id, $order = false){
215
  require_once( 'includes/email-manager.php' );
216
  WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
217
- }
218
 
219
  /**
220
  * Send email when order status change to "Updated Tracking"
@@ -409,7 +408,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
409
 
410
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
411
 
412
- require_once $this->get_plugin_path() . '/includes/customizer/class-wc-partial-shipped-email-customizer.php';
413
 
414
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-updated-tracking-email-customizer.php';
415
 
4
  * Plugin Name: Advanced Shipment Tracking for WooCommerce
5
  * Plugin URI: https://www.zorem.com/products/woocommerce-advanced-shipment-tracking/
6
  * Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
7
+ * Version: 2.9.9.5
8
  * Author: zorem
9
  * Author URI: https://www.zorem.com
10
  * License: GPL-2.0+
11
  * License URI:
12
  * Text Domain: woo-advanced-shipment-tracking
13
  * Domain Path: /lang/
14
+ * WC tested up to: 4.1.0
15
  */
16
 
17
 
22
  *
23
  * @var string
24
  */
25
+ public $version = '2.9.9.5';
26
 
27
  /**
28
  * Initialize the main plugin function
166
  add_action("fix_shipment_tracking_for_deleted_tracking", array( $this->actions, 'func_fix_shipment_tracking_for_deleted_tracking' ), 10, 3 );
167
 
168
  add_action('admin_footer', array( $this->actions, 'custom_validation_js'));
169
+
 
170
  add_action( 'wp_ajax_add_inline_tracking_number', array( $this->actions, 'save_inline_tracking_number' ) );
171
 
172
  //load css js
183
 
184
  $wc_ast_status_delivered = get_option('wc_ast_status_delivered');
185
  if($wc_ast_status_delivered == 1)
186
+ add_action( 'woocommerce_order_status_delivered', array( $this, 'email_trigger_delivered' ), 10, 2 );
187
 
188
  $wc_ast_status_partial_shipped = get_option('wc_ast_status_partial_shipped');
189
  if($wc_ast_status_partial_shipped == 1)
190
+ add_action( 'woocommerce_order_status_partial-shipped', array( $this, 'email_trigger_partial_shipped' ), 10, 2 );
191
 
192
  $wc_ast_status_updated_tracking = get_option('wc_ast_status_updated_tracking');
193
  if($wc_ast_status_updated_tracking == 1)
213
  public function email_trigger_partial_shipped($order_id, $order = false){
214
  require_once( 'includes/email-manager.php' );
215
  WC()->mailer()->emails['WC_Email_Customer_Partial_Shipped_Order']->trigger( $order_id, $order );
216
+ }
217
 
218
  /**
219
  * Send email when order status change to "Updated Tracking"
408
 
409
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-email-customizer.php';
410
 
411
+ require_once $this->get_plugin_path() . '/includes/customizer/class-wc-partial-shipped-email-customizer.php';
412
 
413
  require_once $this->get_plugin_path() . '/includes/customizer/class-wc-updated-tracking-email-customizer.php';
414