Simple Auction integration – PHP HELP needed!

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate Simple Auction integration – PHP HELP needed!

Viewing 0 reply threads
  • Author
    Posts
    • #127841
      James Bieniek
      Participant

      Hi, I posted in another thread, but it is saying I am not logged in there (i am), so I can’t reply…I was away from this project awhile…

      I needed a solution for “simple auction” integration. I don’t want users to have to select the start date, end date, and relisting duration – I want these to be hard-coded to be uniform. A 14 day auction by default.

      Now the below code works, except one big problem:

        Once a new auction is created, the duration of ALL auctions are reset to 14 days.

      I can’t have that. I need the existing auction to remain on the timer they started, with.

      Will anybody please review bottom code and offer a solution to the above problem (all auctions resetting to 14 days)

      add_filter( 'wcfm_product_manage_wcsauction_fields', function( $auction_fileds, $product_id ) {
        if( !$product_id ) {
        	$_format = "Y-m-d h:m:s";
        	$_CurrentTime = new DateTime();
        	if( isset( $auction_fileds['_auction_dates_from'] ) ) {
        		$auction_fileds['_auction_dates_from']['value'] = $_CurrentTime->format($_format);
      		}
      		if( isset( $auction_fileds['_auction_dates_to'] ) ) {
      			$_Current_to = $_CurrentTime->add(new DateInterval('P14D')); 
      			$auction_fileds['_auction_dates_to']['value'] = $_Current_to->format($_format);
      		}
        }
        $auction_fileds = wcfm_hide_field( '_auction_dates_from', $auction_fileds );
        $auction_fileds = wcfm_hide_field( '_auction_dates_to', $auction_fileds );
        return $auction_fileds;
      }, 50, 2 );
Viewing 0 reply threads
  • You must be logged in to reply to this topic.