Page 1 of 1

Wordpress landing widget does not read URL items

Posted: Sat Apr 09, 2016 2:17 pm
by dutchessuganda
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?

Re: Wordpress landing widget does not read URL items

Posted: Sat Apr 09, 2016 5:04 pm
by annettemorgenroth
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.

Re: Wordpress landing widget does not read URL items

Posted: Thu Apr 14, 2016 2:24 pm
by dutchessuganda
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?

Re: Wordpress landing widget does not read URL items

Posted: Sat Apr 16, 2016 11:48 am
by markkinchin
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