Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Simple Auction integration – PHP HELP needed!
- This topic has 0 replies, 1 voice, and was last updated 4 years, 6 months ago by James Bieniek.
Viewing 0 reply threads
- AuthorPosts
- May 7, 2020 at 8:39 am #127841James BieniekParticipant
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 );
- AuthorPosts
Viewing 0 reply threads
- You must be logged in to reply to this topic.