Join our new community forum for support & discussion

Join Now

Home Support Extensions Bookings Bookings (button appear and payments)

Bookings (button appear and payments)

  • Author
    Posts
  • Bemay1

    Hi, I’m thinking about getting booking extension… my questions are:
    1 – The button will appear on all listings?
    2 – Can I make it appear only on a certain category?
    3 – When user books something he pays at that moment or is only the request?
    4 – Is it possible to book only if pays at the moment?
    Thank you!

    ihor developer

    Hi,
    1. Yes.
    2. It’s possible, but with a custom code snippet https://hivepress.io/support/topic/hide-bookings-extension-price-attribute-for-certain-categories-sub-categories/#post-20132
    3. It’s only the request, but it’s possible to enable online payments with the Marketplace extension.
    4. Yes, if you want to process payments immediately and approve a paid booking automatically it’s possible with the Marketplace extension.

    Bemay1

    So I tried the snippet but it does not match my needs;
    – I need bookings working on only two categories;
    – The others I need to stay the normal marketplace “Buy now” button!
    – And also it is not displaying the prices with the snippet.

    ihor developer

    Yes, the snippets just disabled bookings on selected categories, it doesn’t bring the Buy Now form back since it’s overridden by the booking form. This would require more customizations.
    Sorry, the Bookings/Marketplace extensions are not specific to categories, these are global but we’ll try to find a solution for this in future updates.

    Bemay1

    Hi, there is news on this? This is so important!

    ihor developer

    Sorry, there’s no category-specific option for Bookings yet. If it’s urgent we can customize this directly on your site until the Bookings update with this feature is released https://hivepress.io/customization/

    Bemay1

    Hi, how is the progress on this important and needed feature?

    ihor developer

    It’s not available yet, but we’ll add it as soon as possible. There were 2 updates for Bookings this week and we’re working on more improvements.

    Bemay1

    Hi, @ihor! Passing to check how is this going… Is it close? Are you doing a code snippet or adding like a feature? Thank you!

    ihor developer

    Yes, we’re working on it but there’s no ETA yet (there are a few urgent updates required for other extensions). Please let me know if the only requirement (in addition to the suggested snippet) is showing the Buy Now button in categories where bookings are disabled, we can try to provide a temporary code snippet for this.

    Bemay1

    Yes, is only that!

    yevhen developer

    Please try this PHP snippet. Just change numbers in $categories = [1,2,3]; on categories where you want to show Buy Now button

    add_filter(
    	'hivepress/v1/templates/listing_view_page/blocks',
    	function( $blocks, $template ) {
    		$listing = $template->get_context( 'listing' );
    		$categories = [1,2,3];
    		if ( $listing && array_intersect( $categories, (array) $listing->get_categories__id() ) ) {
    			$blocks = hivepress()->helper->merge_trees(
    				[ 'blocks' => $blocks ],
    				[
    					'blocks' => [
    						'listing_actions_primary' => [
    							'blocks' => [
    								'listing_buy_form' => [
    									'type'       => 'form',
    									'form'       => 'listing_buy',
    									'_order'     => 5,
    
    									'attributes' => [
    										'class' => [ 'hp-form--narrow' ],
    									],
    								],
    							],
    						],
    					],
    				]
    			)['blocks'];
    		}
    
    		return $blocks;
    	},
    	1000,
    	2
    );
    Bemay1

    So close, the only problem is that the “book now” button still appears… So we have the two buttons on the category… Can you just remove if there is buy now, remove “book now”

    Efim

    Is it possible to use other filters, for example the listing with attachment?

    Bemay1

    Finally, is done!!! I used the snippet on this one to complement https://hivepress.io/support/topic/hide-bookings-extension-price-attribute-for-certain-categories-sub-categories/#post-20146
    Thank you, thank you!!!!

    ihor developer

    Thanks, I’m glad the issue is resolved 🙂


    @Efim
    If you mean the listing search filters please create a new topic, this one is related to making booking features category-specific.

    Efim

    This code selects by category

    $categories = [1,2,3];
    		if ( $listing && array_intersect( $categories, (array) $listing->get_categories__id() ) ) 

    how to select listings with attachments?

    ihor developer

    If it’s a custom attachment attribute you can check its value by the attribute name this way:

    $listing->get_attributename__id()

    Efim

    Good! This snippet hides button “book now” and shows button “buy now” if it is a digital product:

    add_filter(
    	'hivepress/v1/templates/listing_view_page/blocks',
    	function( $blocks, $template ) {
    		$listing = $template->get_context( 'listing' );
    		if ( $listing && $listing->get_attachments__id() ) {
    			$blocks = hivepress()->helper->merge_trees(
    				[ 'blocks' => $blocks ],
    				[
    					'blocks' => [
    						'listing_actions_primary' => [
    							'blocks' => [
    								'listing_buy_form' => [
    									'type'       => 'form',
    									'form'       => 'listing_buy',
    									'_order'     => 5,
    
    									'attributes' => [
    										'class' => [ 'hp-form--narrow' ],
    									],
    								],
    							],
    						],
    						'booking_make_form' => [
    							'type' => 'content',
    						],
    					],
    				]
    			)['blocks'];
    		}
    
    		return $blocks;
    	},
    	1000,
    	2
    );
    ihor developer

    Thanks for posting the solution!

Viewing 20 posts - 1 through 20 (of 20 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.