Changeset 2723145
- Timestamp:
- 05/13/2022 06:19:58 AM (4 years ago)
- Location:
- hfd-integration/trunk
- Files:
-
- 2 edited
-
class/App.php (modified) (2 diffs)
-
hfd-woocommerce-epost.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hfd-integration/trunk/class/App.php
r2451819 r2723145 79 79 //update plugin settings if its not saved 80 80 add_action( 'plugins_loaded', array( $this, 'hfdUpdatePluginsOptions' ) ); 81 } 81 82 //update time in post meta on specifc order status 83 $hfd_auto_sync_time = get_option( 'hfd_auto_sync_time' ); 84 $hfd_auto_sync_status = get_option( 'hfd_auto_sync_status' ); 85 if( !empty( $hfd_auto_sync_time ) && !empty( $hfd_auto_sync_status ) ){ 86 $orderStatus = str_replace( 'wc-', '', $hfd_auto_sync_status ); 87 add_action( 'woocommerce_order_status_'.$orderStatus, array( $this, 'hfd_woocommerce_order_status_change_cb' ), 10, 1 ); 88 } 89 } 90 91 public function hfd_woocommerce_order_status_change_cb( $order_id ){ 92 $hfd_auto_sync_time = get_option( 'hfd_auto_sync_time' ); 93 $hfd_auto_sync_time = ( $hfd_auto_sync_time * 60 ); 94 update_post_meta( $order_id, 'hfd_order_status_changed_date', time() + $hfd_auto_sync_time ); 95 } 82 96 83 97 public function hfdUpdatePluginsOptions(){ … … 112 126 113 127 $orderIds = get_posts( array( 114 'numberposts' => - 1,128 'numberposts' => -1, 115 129 'post_type' => array( 'shop_order' ), 116 130 'post_status' => array( $hfd_auto_sync_status ), 117 'date_query' => array(118 'after' => date( 'Y-m-d H:i:s', strtotime( '-'.$hfd_auto_sync_time.' minutes' ) ),119 'before' => date( 'Y-m-d H:i:s', time() )120 ),121 131 'meta_query' => array( 122 132 array( 123 133 'key' => 'hfd_ship_number', 124 134 'compare' => 'NOT EXISTS' // this should work... 135 ), 136 array( 137 'key' => 'hfd_sync_flag', 138 'compare' => 'NOT EXISTS' 139 ), 140 array( 141 'key' => 'hfd_order_status_changed_date', 142 'value' => time(), 143 'compare' => '>=', 125 144 ) 126 145 ), -
hfd-integration/trunk/hfd-woocommerce-epost.php
r2722560 r2723145 4 4 Plugin URI: 5 5 Description: Add shipping method of ePost, allowing the user on the checkout, to select the pickup location point from a google map popup. Also allows to synch the order to HFD API after the order is created. 6 Version: 2. 3.06 Version: 2.4.0 7 7 Author: HFD 8 8 Author URI: https://www.hfd.co.il
Note: See TracChangeset
for help on using the changeset viewer.