Advanced Shipment Tracking for WooCommerce - Version 2.9.9.4

Version Description

  • Dev - Fix slow load issue of WordPress dashboard because of TrckShip Analytics dashboard
  • Fix - Fix custom order number issue with Sequential Order Numbers Pro in bulk import
  • Fix - Fix issue with search orders with tracking number in orders panel
Download this release

Release Info

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

Code changes from version 2.9.8 to 2.9.9.4

assets/css/icons/failure-o (Hitesh Patel's conflicted copy 2020-04-29).png DELETED
File without changes
assets/shipment-provider-img/dawn-wing.png ADDED
Binary file
assets/shipment-provider-img/postnord-sverige-ab (Hitesh Patel's conflicted copy 2020-04-29).png DELETED
File without changes
assets/shipment-provider-img/sda (Hitesh Patel's conflicted copy 2020-04-29).png DELETED
File without changes
assets/shipment-provider-img/turkey-post (Hitesh Patel's conflicted copy 2020-04-29).png DELETED
File without changes
assets/shipment-provider-img/ubi-smart-parcel.png ADDED
Binary file
includes/class-wc-advanced-shipment-tracking-admin.php CHANGED
@@ -101,12 +101,12 @@ 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
 
@@ -227,7 +227,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' => -1,
231
  );
232
  if( $range != 0 ){
233
  $start = strtotime( date( 'Y-m-d 00:00:00', strtotime( '-'.$range.' days' ) ));
@@ -633,10 +633,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
633
  $checked="";
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>
@@ -658,10 +658,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
658
  </div>
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>
@@ -1832,7 +1832,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1832
  public static function bulk_shipment_status_from_settings_fun(){
1833
  $args = array(
1834
  'status' => 'wc-completed',
1835
- 'limit' => -1,
1836
  'date_created' => '>' . ( time() - 2592000 ),
1837
  );
1838
  $orders = wc_get_orders( $args );
@@ -1860,7 +1860,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1860
  public static function bulk_shipment_status_for_empty_balance_from_settings_fun(){
1861
  $args = array(
1862
  'status' => 'wc-completed',
1863
- 'limit' => -1,
1864
  'date_created' => '>' . ( time() - 2592000 ),
1865
  );
1866
  $orders = wc_get_orders( $args );
@@ -1890,7 +1890,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
1890
  public static function bulk_shipment_status_for_do_connection_from_settings_fun(){
1891
  $args = array(
1892
  'status' => 'wc-completed',
1893
- 'limit' => -1,
1894
  'date_created' => '>' . ( time() - 2592000 ),
1895
  );
1896
  $orders = wc_get_orders( $args );
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
 
107
+ // add bulk order tracking number filter for exported / non-exported orders
108
+ add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'filter_orders_by_tracking_number_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
 
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' ) ));
633
  $checked="";
634
  }?>
635
  <span class=" multiple_checkbox">
636
+ <label class="" for="<?php echo $key?>">
 
637
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
638
+ <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
639
+ <span class="multiple_label"><?php echo $val['status']; ?></span>
640
  </br>
641
  </label>
642
  </span>
658
  </div>
659
  <?php } ?>
660
  <span class="multiple_checkbox">
661
+ <label class="" for="<?php echo $key?>">
 
662
  <input type="hidden" name="<?php echo $id?>[<?php echo $key?>]" value="0"/>
663
+ <input type="checkbox" id="<?php echo $key?>" name="<?php echo $id?>[<?php echo $key?>]" class="" <?php echo $checked; ?> value="1"/>
664
+ <span class="multiple_label"><?php echo $val['status']; ?></span>
665
  </br>
666
  </label>
667
  </span>
1832
  public static function bulk_shipment_status_from_settings_fun(){
1833
  $args = array(
1834
  'status' => 'wc-completed',
1835
+ 'limit' => 100,
1836
  'date_created' => '>' . ( time() - 2592000 ),
1837
  );
1838
  $orders = wc_get_orders( $args );
1860
  public static function bulk_shipment_status_for_empty_balance_from_settings_fun(){
1861
  $args = array(
1862
  'status' => 'wc-completed',
1863
+ 'limit' => 100,
1864
  'date_created' => '>' . ( time() - 2592000 ),
1865
  );
1866
  $orders = wc_get_orders( $args );
1890
  public static function bulk_shipment_status_for_do_connection_from_settings_fun(){
1891
  $args = array(
1892
  'status' => 'wc-completed',
1893
+ 'limit' => 100,
1894
  'date_created' => '>' . ( time() - 2592000 ),
1895
  );
1896
  $orders = wc_get_orders( $args );
includes/class-wc-advanced-shipment-tracking-settings.php CHANGED
@@ -557,40 +557,54 @@ class WC_Advanced_Shipment_Tracking_Settings {
557
 
558
  wp_enqueue_script( 'amcharts');
559
  wp_enqueue_script( 'amcharts-light-theme');
560
-
561
- // Get orders completed.
562
- $args = array(
563
- //'status' => 'wc-completed',
564
- 'limit' => -1,
565
- 'date_created' => '>' . ( time() - 2592000 ),
566
- );
567
- $orders = wc_get_orders( $args );
568
- $shipment_trackers = 0;
 
 
 
 
 
 
 
 
 
 
 
 
569
  $shipment_status = array();
570
  $shipment_status_merge = array();
571
  $tracking_item_merge = array();
572
- foreach($orders as $order){
573
- $order_id = $order->get_id();
574
-
575
- $ast = new WC_Advanced_Shipment_Tracking_Actions;
576
- $tracking_items = $ast->get_tracking_items( $order_id, true );
577
-
578
- if($tracking_items){
579
- $shipment_status = get_post_meta( $order_id, "shipment_status", true);
 
 
580
 
581
- if(is_array($shipment_status)){
582
- $shipment_status_merge = array_merge($shipment_status_merge, $shipment_status);
583
- }
584
- //echo '<pre>';print_r($shipment_status_merge);echo '</pre>';
 
585
  foreach ( $tracking_items as $key => $tracking_item ) {
586
  if( isset($shipment_status[$key]) ){
587
- $tracking_item_merge[] = $tracking_item;
588
- $shipment_trackers++;
589
  }
590
  }
591
  }
592
  }
593
-
594
  $shipment_status_arr = array();
595
 
596
  foreach ((array)$shipment_status_merge as $key => $item) {
@@ -599,9 +613,10 @@ class WC_Advanced_Shipment_Tracking_Settings {
599
 
600
  $tracking_provider_arr = array();
601
 
602
- foreach ($tracking_item_merge as $key => $item) {
603
- $tracking_provider_arr[$item['formatted_tracking_provider']][$key] = $item;
604
- }
 
605
 
606
  $tracking_issue_array = array();
607
  foreach($shipment_status_arr as $status => $val){
@@ -611,10 +626,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
611
  }
612
 
613
  ksort($shipment_status_arr, SORT_NUMERIC);
614
- ksort($tracking_provider_arr, SORT_NUMERIC);
615
-
616
-
617
-
618
  ?>
619
  <script type="text/javascript">
620
  AmCharts.makeChart("ast_dashboard_status_chart",
@@ -782,7 +794,7 @@ class WC_Advanced_Shipment_Tracking_Settings {
782
 
783
  </div>
784
  <div class="widget_footer">
785
- <a class="" href="https://my.trackship.info/analytics/" target="blank"><?php _e( 'View more on TrackShip','woo-advanced-shipment-tracking' ); ?></a>
786
  </div>
787
  <?php }
788
 
557
 
558
  wp_enqueue_script( 'amcharts');
559
  wp_enqueue_script( 'amcharts-light-theme');
560
+
561
+ global $wpdb;
562
+ $paid_order_statuses = array('completed','delivered','shipped');
563
+ $shipment_status_results = $wpdb->get_results( "
564
+ SELECT p.ID, pm.* FROM {$wpdb->prefix}posts AS p
565
+ INNER JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id
566
+ WHERE p.post_status IN ( 'wc-" . implode( "','wc-", $paid_order_statuses ) . "' )
567
+ AND p.post_type LIKE 'shop_order'
568
+ AND pm.meta_key = 'shipment_status'
569
+ AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'
570
+ " );
571
+
572
+ $tracking_items_results = $wpdb->get_results( "
573
+ SELECT p.ID, pm.* FROM {$wpdb->prefix}posts AS p
574
+ INNER JOIN {$wpdb->prefix}postmeta AS pm ON p.ID = pm.post_id
575
+ WHERE p.post_status IN ( 'wc-" . implode( "','wc-", $paid_order_statuses ) . "' )
576
+ AND p.post_type LIKE 'shop_order'
577
+ AND pm.meta_key = '_wc_shipment_tracking_items'
578
+ AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'
579
+ " );
580
+
581
  $shipment_status = array();
582
  $shipment_status_merge = array();
583
  $tracking_item_merge = array();
584
+
585
+ foreach($shipment_status_results as $order){
586
+ $order_id = $order->ID;
587
+ $shipment_status = unserialize($order->meta_value);
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){
596
+ $order_id = $order->ID;
597
+ $tracking_items = unserialize($order->meta_value);
598
+
599
+ if($tracking_items){
600
  foreach ( $tracking_items as $key => $tracking_item ) {
601
  if( isset($shipment_status[$key]) ){
602
+ $tracking_item_merge[] = $tracking_item;
 
603
  }
604
  }
605
  }
606
  }
607
+
608
  $shipment_status_arr = array();
609
 
610
  foreach ((array)$shipment_status_merge as $key => $item) {
613
 
614
  $tracking_provider_arr = array();
615
 
616
+ foreach ($tracking_item_merge as $key => $item) {
617
+ $tracking_provider = $wpdb->get_var( "SELECT provider_name FROM {$this->table} WHERE ts_slug = '".$item['tracking_provider']."'" );
618
+ $tracking_provider_arr[$tracking_provider][$key] = $item;
619
+ }
620
 
621
  $tracking_issue_array = array();
622
  foreach($shipment_status_arr as $status => $val){
626
  }
627
 
628
  ksort($shipment_status_arr, SORT_NUMERIC);
629
+ ksort($tracking_provider_arr, SORT_NUMERIC);
 
 
 
630
  ?>
631
  <script type="text/javascript">
632
  AmCharts.makeChart("ast_dashboard_status_chart",
794
 
795
  </div>
796
  <div class="widget_footer">
797
+ <a class="" href="https://trackship.info/my-account/analytics/" target="blank"><?php _e( 'View more on TrackShip','woo-advanced-shipment-tracking' ); ?></a>
798
  </div>
799
  <?php }
800
 
includes/class-wc-advanced-shipment-tracking.php CHANGED
@@ -1558,7 +1558,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(
@@ -1678,7 +1678,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;
1558
  }
1559
  }
1560
 
1561
+ if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.php' ) ) {
1562
 
1563
  // search for the order by custom order number
1564
  $query_args = array(
1678
  }
1679
  }
1680
 
1681
+ if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers-pro.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;
lang/woo-advanced-shipment-tracking-tr_TR (Hitesh Patel's conflicted copy 2020-04-29).mo DELETED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Advanced Shipment Tracking for WooCommerce ===
2
  Contributors: zorem
3
  Tags: woocommerce, delivery, shipping, shipment tracking, tracking
4
- Requires at least: 4.0
5
- Requires PHP: 5.2.4
6
  Tested up to: 5.4
7
- Stable tag: 5.3
 
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -113,6 +113,8 @@ USPS, ePacket, Delhivery, Yun Express Tracking, UPS, Australia Post, FedEx, Aram
113
  == Documentation ==
114
  [documentation](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking) for more details.
115
 
 
 
116
  https://www.youtube.com/watch?v=Mw7laecPtyw
117
 
118
  == Frequently Asked Questions ==
@@ -156,6 +158,15 @@ http://a32694-tmp.s415.upress.link/wp-json/wc/v1/orders/<order-id>/shipment-trac
156
 
157
  == Changelog ==
158
 
 
 
 
 
 
 
 
 
 
159
  = 2.9.8 =
160
  * 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
161
 
1
  === Advanced Shipment Tracking for WooCommerce ===
2
  Contributors: zorem
3
  Tags: woocommerce, delivery, shipping, shipment tracking, tracking
4
+ Requires at least: 5.0
 
5
  Tested up to: 5.4
6
+ Requires PHP: 7.0
7
+ Stable tag: 4.0.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
113
  == Documentation ==
114
  [documentation](https://www.zorem.com/docs/woocommerce-advanced-shipment-tracking) for more details.
115
 
116
+ [](http://coderisk.com/wp/plugin/woo-advanced-shipment-tracking/RIPS-1AffNoHxVQ)
117
+
118
  https://www.youtube.com/watch?v=Mw7laecPtyw
119
 
120
  == Frequently Asked Questions ==
158
 
159
  == Changelog ==
160
 
161
+ = 2.9.9.4 =
162
+ * Dev - Fix slow load issue of WordPress dashboard because of TrckShip Analytics dashboard
163
+ * Fix - Fix custom order number issue with Sequential Order Numbers Pro in bulk import
164
+ * Fix - Fix issue with search orders with tracking number in orders panel
165
+
166
+ = 2.9.9.3 =
167
+ * Dev - Limit get orders to 100 on TrackShip tools page
168
+ * Fix - version 2.9.8 rollback
169
+
170
  = 2.9.8 =
171
  * 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
172
 
woocommerce-advanced-shipment-tracking.php CHANGED
@@ -4,7 +4,7 @@
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.8
8
  * Author: zorem
9
  * Author URI: https://www.zorem.com
10
  * License: GPL-2.0+
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
22
  *
23
  * @var string
24
  */
25
- public $version = '2.9.8';
26
 
27
  /**
28
  * Initialize the main plugin function
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.4
8
  * Author: zorem
9
  * Author URI: https://www.zorem.com
10
  * License: GPL-2.0+
22
  *
23
  * @var string
24
  */
25
+ public $version = '2.9.9.4';
26
 
27
  /**
28
  * Initialize the main plugin function