Home Forums WC Vendors Pro Support Delayed Payments

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41062
    Jason
    Participant

    Hi,

    We’ve talked about this before but I wish to make changes to the core so that we can support delayed payments on new commissions (add a new filter).

    class-commission.php
    The following code is:

    
    	/**
    	 * Return all commission outstanding with a 'due' status
    	 *
    	 * @return object
    	 */
    	public static function get_all_due()
    	{
    		global $wpdb;
    
        $where      = $wpdb->prepare( 'WHERE status = %s', 'due' );
        $where      = apply_filters( 'pv_commission_due_where', $where );
    
    		$table_name = $wpdb->prefix . "pv_commission";
    		$query      = "SELECT id, vendor_id, total_due FROM <code>{$table_name}</code> $where";
    
    		$results    = $wpdb->get_results( $query );
    
    		return $results;
    	}
    

    Adding a new filter for the where clause allows me to do something along these lines:

    
    function delay_new_commission_payments($where) {
      global $wpdb;
    
      $days = 14;
      $newtime = time() - (60 * 60 * 24 * $days);
    
      $where .= $wpdb->prepare(' AND <code>time</code> <= %s', date('Y-m-d H:i', $newtime));
    
      return $where;
    }
    add_filter('pv_commission_due_where', 'delay_new_commission_payments');
    

    Thanks

    #41159
    Anna
    Member

    @jsonuk
    I’ll past this along as a possible add in a future update. Thanks.

    #41206
    WC Vendors Support
    Participant

    Thanks, we’ll get that added to the next release of WC Vendors Free. Next release, you’ll see it in the changelog and can find the filter name there. It probably will not be pv_ since that was from Matt Gates Product Vendors days, mostly we prefix with wcv_ now.

    #41417
    Jason
    Participant

    Ok, thats great. Dont mind what prefix it has – as long as it makes it into the next release, I’m happy 🙂

    #41481
    Jamie
    Keymaster

    Hello,

    I’ve just checked this into the latest free class-commission if you want to pull down the file from github for testing.

    cheers,

    Jamie.

    #41509
    Jason
    Participant

    Thanks for the commit 🙂

    Error on line 189: apply_filters( 'wcvendors_commission_all_due_where', $query );

    Should be $where and not $query.

    Otherwise looks good to me. The other wcvendors_commission_all_due_sql is a welcomed addition 🙂

    Thanks!

    #41529
    Jamie
    Keymaster

    Hello,

    That’s been updated and committed and ready for use. Yes I will be going through and putting filters across all our queries so that we don’t have this issue again, it’s just a matter of time.

    cheers,

    Jamie.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.