Changeset 3142452
- Timestamp:
- 08/27/2024 06:19:37 PM (18 months ago)
- Location:
- routeapp/trunk
- Files:
-
- 6 edited
-
admin/class-routeapp-order-recover.php (modified) (1 diff)
-
includes/class-routeapp-woocommerce.php (modified) (3 diffs)
-
public/class-routeapp-public.php (modified) (1 diff)
-
public/js/routeapp-order-sync.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
routeapp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
routeapp/trunk/admin/class-routeapp-order-recover.php
r3103716 r3142452 103 103 'limit' => $batchSize, 104 104 'offset' => $offset, 105 'date_created' => '>=' . $recoverFrom, 105 106 'date_created' => '<=' . $recoverTo, 106 'date_created' => '>=' . $recoverFrom,107 107 ]; 108 108 -
routeapp/trunk/includes/class-routeapp-woocommerce.php
r2986944 r3142452 22 22 public function init() { 23 23 24 if ($this->routeapp_route_enabled_extra_columns()) { 25 add_filter( 'manage_edit-shop_order_columns', array( $this, 'routeapp_add_order_route_columns_header' ), 20 ); 26 add_action( 'manage_shop_order_posts_custom_column', array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) ); 27 add_action( 'restrict_manage_posts', array( $this, 'routeapp_display_admin_shop_order_route_protection_filter' ) ); 28 add_action( 'pre_get_posts', array( $this, 'routeapp_process_admin_shop_order_route_protection' ) ); 29 } 30 } 24 if ($this->routeapp_route_enabled_extra_columns()) { 25 add_filter( 'manage_edit-shop_order_columns', array( $this, 'routeapp_add_order_route_columns_header' ), 20 ); 26 add_action( 'manage_shop_order_posts_custom_column', array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 ); 27 add_action( 'restrict_manage_posts', array( $this, 'routeapp_display_admin_shop_order_route_protection_filter' ) , 99 ); 28 add_action( 'pre_get_posts', array( $this, 'routeapp_process_admin_shop_order_route_protection' ) , 99 ); 29 30 add_action( 'manage_woocommerce_page_wc-orders_custom_column', array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 ); 31 add_action( 'manage_shop_order_custom_column', array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 ); 32 33 add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'routeapp_add_order_route_columns_header' ), 20 ); 34 35 } 36 } 31 37 32 38 /** … … 56 62 * @return void 57 63 */ 58 public function routeapp_manage_route_charge_posts_custom_column( $column ) { 59 global $post; 60 $order = wc_get_order( $post->ID ); 64 public function routeapp_manage_route_charge_posts_custom_column( $column, $orderParam ) { 65 global $post; 61 66 62 if ( $column === 'route_charge' ) { 63 echo wc_price( $this->routeapp_get_route_charge_fee( $order ), array( 'currency' => $order->get_currency() ) ); 64 } else if ( $column === 'route_protection' ) { 65 echo $this->routeapp_order_has_route_protection_fee( $order ) ? "Yes" : "No"; 66 } 67 } 67 // Check if $orderParam is set and not null 68 if ( isset( $orderParam ) && ! is_null( $orderParam ) ) { 69 $order = $orderParam; // Get the order using $orderParam if it's valid 70 } else { 71 $order = wc_get_order( $post->ID ); // Fallback to global $post if $orderParam is not set 72 } 73 74 if ( $column === 'route_charge' ) { 75 echo wc_price( $this->routeapp_get_route_charge_fee( $order ), array( 'currency' => $order->get_currency() ) ); 76 } else if ( $column === 'route_protection' ) { 77 echo $this->routeapp_order_has_route_protection_fee( $order ) ? "Yes" : "No"; 78 } 79 } 68 80 69 81 /** … … 101 113 */ 102 114 public function routeapp_order_has_route_protection_fee( $order ) { 103 $route_protection = get_post_meta($order->get_id(), '_routeapp_route_protection', true); 115 $route_protection = "0"; 116 if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 117 && OrderUtil::custom_orders_table_usage_is_enabled() ) { 118 // HPOS usage is enabled. 119 $route_protection = $order->get_meta('_routeapp_route_protection'); 120 } else { 121 // Traditional CPT-based orders are in use. 122 $route_protection = get_post_meta($order->get_id(), '_routeapp_route_protection', true); 123 } 124 104 125 return $route_protection === "1"; 105 126 } -
routeapp/trunk/public/class-routeapp-public.php
r2980248 r3142452 777 777 $acceptedCanceledStatuses = get_option('routeapp_cancel_order_statuses') ? get_option('routeapp_cancel_order_statuses') : []; 778 778 779 780 foreach ($order->get_items('fee') as $fee) { 781 if ($fee->get_name() === $this->routeapp_get_insurance_label()) { 782 $insurance_selected = true; 783 $insurance_amount = $fee->get_amount(); 784 if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 785 && OrderUtil::custom_orders_table_usage_is_enabled() ) { 786 // HPOS usage is enabled. 787 $order->update_meta_data('_routeapp_route_charge', $insurance_amount ); 788 $order->update_meta_data('_routeapp_route_protection', $insurance_selected); 789 $order->save(); 790 } else { 791 // Traditional CPT-based orders are in use. 792 update_post_meta( $order->get_id(), '_routeapp_route_charge', $insurance_amount ); 793 update_post_meta( $order->get_id(), '_routeapp_route_protection', $insurance_selected ); 794 } 795 } 796 } 797 779 798 if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 780 799 && OrderUtil::custom_orders_table_usage_is_enabled() ) { -
routeapp/trunk/public/js/routeapp-order-sync.js
r3103711 r3142452 80 80 recoverTo = response.data.recoverTo; 81 81 waitTime = response.data.waitTime; 82 82 processedCount = 0; 83 offset = 0; 84 83 85 $('#message').html('<p> Orders processed: ' + totalOrders + '/' + processedCount + '</p>'); 84 86 -
routeapp/trunk/readme.txt
r3104227 r3142452 6 6 Requires at least: 4.0 7 7 Tested up to: 6.4.1 8 Stable tag: 2.2. 188 Stable tag: 2.2.20 9 9 Requires PHP: 5.6 10 10 License: GPLv2 or later … … 106 106 107 107 == Changelog == 108 = 2.2.20 = 109 * Fix route information columns, display correct information 110 111 = 2.2.19 = 112 * Minor update on code format 113 108 114 = 2.2.18 = 109 115 * Update shipping tracking status for shipping providers -
routeapp/trunk/routeapp.php
r3104227 r3142452 10 10 * Plugin URI: https://route.com/for-merchants/ 11 11 * Description: Route allows shoppers to insure their orders with one-click during checkout, adding a layer of 3rd party trust while improving the customer shopping experience. 12 * Version: 2.2. 1812 * Version: 2.2.20 13 13 * Author: Route 14 14 * Author URI: https://route.com/ … … 26 26 * Currently plugin version. 27 27 */ 28 define( 'ROUTEAPP_VERSION', '2.2. 18' );28 define( 'ROUTEAPP_VERSION', '2.2.20' ); 29 29 30 30 /**
Note: See TracChangeset
for help on using the changeset viewer.