WooCommerce Bookings Integration

Home Forums Plugin or Theme Compatibility WooCommerce Bookings Integration

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 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #68319
    Luc Habrant
    Participant

    Hello,

    In the WC Pro dashboard (front-end), when a vendor confirms a pending booking, it disappears because author in database is changed from vendor ID to customer ID.

    In the file plugins/public/class-wcvendors-pro-table-helper.php, method ‘set_defaults’ returns posts with the vendor ID:

    // Default table rows 
    		$args = array(
    				'posts_per_page' => apply_filters( 'wcvendors_pro_table_post_per_page_' . $this->id, 20 ),
    				'post_type'   => $this->post_type,
    				'author' 	  => $this->vendor_id,
    				'post_status' => 'any',
    				'paged'		  => $paged, 
    				's'			  => $search, 
    		);
    
    		$args = apply_filters( 'wcvendors_pro_table_row_args_' . $this->id, $args );
    		$results = new WP_Query( $args ); 
    		
    		$this->rows = apply_filters( 'wcvendors_pro_table_rows_' . $this->id, $results->posts, $results );

    To solve the problem, I need to add this code in the file plugins/wc-vendors-woocommerce-bookings/includes/class-wcv-wcb-bookings-controller.php:

    public function table_rows( $rows, $result_object ) {
    		
    		$vendor_products  = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'product', 'author' => get_current_user_id() ) );
    		$vendor_products_ids = wp_list_pluck( $vendor_products, 'ID' );
    		
    		$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    
    		$search = isset( $_POST[ 'wcv-search'] ) ?  $_POST[ 'wcv-search'] : ''; 
    		
    		$args = array(
    			'posts_per_page' => apply_filters( 'wcvendors_pro_table_post_per_page_wc_booking', 20 ),
    			'post_type'   => 'wc_booking',
    			//'author' 	  => get_current_user_id(),
    			'post_status' => 'any',
    			'paged'		  => $paged, 
    			's'			  => $search,
    			'meta_query' => array(
    				array(
    					'key'     => '_booking_product_id',
    					'value'   => $vendor_products_ids,
    					'compare' => 'IN'
    				)
    			)
    		);
    
    		$args = apply_filters( 'wcvendors_pro_table_row_args_wc_booking', $args );
    		$results = new WP_Query( $args ); 
    		
    		$rows = $results->posts;
    		
    		$result_object = $results;
    		
    		$this->max_num_pages 	= $result_object->max_num_pages; 
    		$new_rows 				= array();

    Unfortunately, the vendor can’t see the booking in the WC Pro dashboard if the product linked is deleted. Can you suggest a better solution, please ?

    • This topic was modified 2 years, 8 months ago by Luc Habrant.
    #68436
    Anna
    Keymaster

    @apestrategie
    Hello,
    OK- we are looking into this and if I have any additional information I will update you.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Plugin or Theme Compatibility’ is closed to new topics and replies.

This website uses cookies to ensure you get the best experience on our website.