Plugin Directory

Changeset 2723145


Ignore:
Timestamp:
05/13/2022 06:19:58 AM (4 years ago)
Author:
hfddev
Message:

Bug fixes

Location:
hfd-integration/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hfd-integration/trunk/class/App.php

    r2451819 r2723145  
    7979        //update plugin settings if its not saved
    8080        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    }
    8296   
    8397    public function hfdUpdatePluginsOptions(){
     
    112126       
    113127        $orderIds = get_posts( array(
    114             'numberposts' => - 1,
     128            'numberposts' => -1,
    115129            'post_type'   => array( 'shop_order' ),
    116130            '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             ),
    121131            'meta_query' => array(
    122132                array(
    123133                    'key' => 'hfd_ship_number',
    124134                    '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' => '>=',
    125144                )
    126145            ),
  • hfd-integration/trunk/hfd-woocommerce-epost.php

    r2722560 r2723145  
    44Plugin URI:
    55Description: 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.0
     6Version: 2.4.0
    77Author: HFD
    88Author URI: https://www.hfd.co.il
Note: See TracChangeset for help on using the changeset viewer.