Advanced Shipment Tracking for WooCommerce - Version 2.9.9.3

Version Description

  • Dev - Limit get orders to 100 on TrackShip tools page
  • Fix - version 2.9.8 rollback
Download this release

Release Info

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

Code changes from version 2.9.8 to 2.9.9.3

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
@@ -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' ) ));
@@ -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 );
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' ) ));
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
 
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
 
@@ -156,6 +156,10 @@ 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
 
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
 
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.3
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.3';
26
 
27
  /**
28
  * Initialize the main plugin function