Passing booking state via form

Help with installation and general calendar setttings

Passing booking state via form

Postby alastair » Thu Nov 08, 2012 12:26 pm

Firstly, thanks for the great script. :)

I have followed your instructions in the thread about forms to make my dates clickable to create a form with METHOD="get" which feeds into my ecommerce system. It's been working great.

Now I need to pass a little more data to my ecommerce system via that form and the URL query string; the data would be used to show different options to the user (further down the line in the purchase - and no longer in an ajax availability calendar page). The data I need to pass across is the booking state.

So I have been trying (and failing) to create a field in the form that picks up the booking state of the date clicked. Do you have any suggestions about how to achieve this please?
alastair
 
Posts: 5
Joined: Wed Sep 01, 2010 12:29 pm

Re: Passing booking state via form

Postby alastair » Fri Dec 07, 2012 12:09 pm

Any advice on this please? Any help would be much appreciated! :)
alastair
 
Posts: 5
Joined: Wed Sep 01, 2010 12:29 pm

Re: Passing booking state via form

Postby chris » Wed Dec 12, 2012 9:23 pm

Hi,
sorry for the delay on replying to you.

You will probably need to read the date "class".
The dates that have a booking state (ie. not "available" have the class name in them to be able to show the correct style.
This class can be accessed by using ssomething like:
Code: Select all
var state=this.get("class");


However the problem with this method is that you will also get the class "clickable" which is set for all the clickable dates.

I would suggest that you modifiy the PHP code that creates the calendar month and add a new data-type to hold just the booking state something like this (in the functions.inc.php file ln 153):

Code: Select all
<li class="'.$day_classes.' "  id="date_'.$date_db.'" title="'.$date_format.$day_title_state.'" data-date="'.$date_format.'" data-state="'.$booked_days[$date_db]["state"].'">'.$day_counter.'</li>';


You could then access this data-type in the same way as the css class but without any extra data to worry about.

So, you will need to slightly modify the PHP code in the ac-includes > functions.inc.php file and then alter your already modified JS code to get this new data and pass it to your bookings form.

Chris
User avatar
chris
Site Admin
 
Posts: 1088
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron