Wordpress landing widget does not read URL items

Everything related to your website and the Beds24 widgets
Post Reply
dutchessuganda
Posts: 7
Joined: Sat Apr 09, 2016 11:46 am

Hello,

In my wordpress site I have a page with the [beds24-landing] widget. On another page I have each room display with a button at each room referring to the URL of the landing widget. ([beds24-button href="http://testsite.com/test-booking" target="new" roomid="12345"])

The problem is that after pressing the button, all rooms are shown in the booking page, not only the selected room.

If I test without the href, it works fine but I want to have the booking page embedded in my website.
The URL is showing all relevant info (http://testsite.com/test-booking/?1&own ... numadult=1)
but somehow the landing widget does not get the info (altering the URL info does not have any effect on the booking page)

I tested a good number of variations on the widgets parameters, but all with the same result: the landing widget does not read the URL info.

Do you have any idea how to solve this?
annettemorgenroth
Posts: 1337
Joined: Sun Jun 30, 2013 8:44 am

You will need to add the room id to the short code if you want to open a booking page for an individual room. Example: [beds24-landing roomid="1"] will open the booking page for Beds24 room id 1. Replace 1 with the ID of your room.
dutchessuganda
Posts: 7
Joined: Sat Apr 09, 2016 11:46 am

Sorry, but that does not solve the issue that the landing widget does not read the roomid from the URL. A static roomid is certainly not the solution.

So I went into the code of "beds24-online-booking.php" to find out what the problem is:
- Here I see that around line 205 the "get_post_meta" function is called to see if the URL dictates a room id, but this function fails to get the roomid.
- This problem applies to all Wordpress sites using the Permalink structure, Wordpress needs to know the parameter name, otherwise the parameter is not passed to the code.

Solution:
- Let Wordpress know all parameters you are going to send by adding this piece of code to the beds24 widget (for the time being I placed it in functions.php of my Theme):

Code: Select all

add_filter( 'query_vars', 'add_query_vars_filter' );
function add_query_vars_filter( $vars ){
  $vars[] = "ownerid";
  $vars[] = "propid";
  $vars[] = "roomid";
  ....etc........
  return $vars;
}

- Add new checks for all parameters in the above mentioned file starting around line 205(in my case roomid):

Code: Select all

else if (get_query_var('roomid'))	
	$roomid = get_query_var('roomid');
Because this affects most wordpress sites, can you implement this change in the next update of the widgets?
markkinchin
Site Admin
Posts: 935
Joined: Fri Mar 02, 2012 1:43 pm

dutchessuganda wrote: Solution:
- Let Wordpress know all parameters you are going to send by adding this piece of code to the beds24 widget (for the time being I placed it in functions.php of my Theme):

Code: Select all

add_filter( 'query_vars', 'add_query_vars_filter' );
function add_query_vars_filter( $vars ){
  $vars[] = "ownerid";
  $vars[] = "propid";
  $vars[] = "roomid";
  ....etc........
  return $vars;
}

- Add new checks for all parameters in the above mentioned file starting around line 205(in my case roomid):

Code: Select all

else if (get_query_var('roomid'))	
	$roomid = get_query_var('roomid');
Because this affects most wordpress sites, can you implement this change in the next update of the widgets?
Thanks for the suggestion, we have an update for the plugin planned shortly anyway so we will get this idea added
Post Reply