You are here

README.txt in Availability Calendars 7.3

Same filename in this branch
  1. 7.3 README.txt
  2. 7.3 booking_formlet/README.txt
Same filename and directory in other branches
  1. 7.5 booking_formlet/README.txt
  2. 7.4 booking_formlet/README.txt
/**
 * README for Availability Calendar Booking Formlet module.
 *
 * @author Erwin Derksen (fietserwin: http://drupal.org/user/750928)
 */

The availability calendar booking formlet module defines a booking formlet
field that cooperates with Availability Calendar fields. It offers a small form
that can receive an arrival and departure date by reacting to click events on
Availability Calendar fields. If both dates are filled in, the submit button is
enabled and the user can continue to the real booking form.

This form is called a formlet as it is a small minimal form that only receives
the arrival and departure dates. The full booking form, where the visitor can
enter his/her name and other details is to defined separately. Think off an "Add
to cart" form where one can enter the quantity and click on "add to cart" which
brings you to the full cart form.


Dependencies
------------
This sub-module depends on the Availability Calendar module.
Also the form will typically be posted to a webform. So installing the webform
module is recommended.


Limitations
-----------
This module will not:
- Change the calendar. When clicking on the departure date the calendar will be
  updated visually, but this change will not be stored on the server. You can
  define a hook for that. See e.g. the webform documentation to find out which
  (submission) hooks best fit your needs.
- Define the webform. This depends to much on your specific situation.
- Offer payment integration.


Installing
----------
As usual.


Configuring
-----------
After enabling the module:
1) Define the date formats you want to use on admin/config/regional/date-time.
   You can localize these formats in admin/config/regional/date-time/locale.
2) Add a webform to post the form to. See the details below.
3) Add an "Availability Calendar Booking formlet" field to the entity type that
   also has an "Availability Calendar" field. Fill the "URL to continue the
   booking" field with the URL of the webform created in step 2.
4) Set the display settings on the "Manage display" page.
5) Style the form as you like. Note that this module only contains some basic
   styling for the formlet.

Basically this is it. Additionally you may want to define some webform
submission processing. This will be explained further on.


Views integration
-----------------
Suppose you have defined a view that searches on availability. The results page
shows the teasers of the entities that are available during the defined period.
Why not present just the "book now" button and allow the visitor to directly
go to the complete reservation form?

This is possible. You can define default values for the begin and date that can
come from some contextual variable. The results page of the search will probably
have a URL that looks like
search-availability?available[arrival][date]=2012-07-01&available[duration]=2
You can tell the formlet to take the begin date from $_GET, more specifically
the entry available[arrival][date] and that the end date should be based on a
duration (in days) given by the available[duration] entry of $_GET.

You can define this in the display settings for a given display mode. So, the
settings can differ for the full view, where visitors will still have to click
on the calendar before they can proceed to the complete reservation form, and
the teaser, where visitors can directly click on "book now".


How it works
------------
There seems to be quite some confusion about the why and how of this module. So,
following is a bit more in-depth explanation of the ideas behind this module.

Normally the page with the calendar is quite stuffed with all sorts of
information. Thus adding the complete booking form is not desirable. Therefore,
just a small form (aka 'formlet') is rendered that only contains the most basic
fields to allow it to interact with the calendar. Once this information is
completed by the visitor, it can be forwarded to the complete booking form.

Step by step:
- A visitor arrives at your site and, hopefully, eventually at the page with the
  Availability Calendar.
- The Availability Calendar module renders the calendar and defines the
  javasript that allows the visitor to click on available dates.
- This module adds the 'formlet' to that page including some javascript to
  handle the date click events and place the selected dates on the formlet.
- When the user clicks on "Book this resource ..." all information is POSTed to
  another page. This page is defined in the field settings and normally points
  to a webform with the real booking form.
- Together with the arrival and departure dates, a lot of hidden fields are
  submitted. These hidden fields contain information about the calendar field
  and the entity the calendar is attached to. (Note that calendar fields may be
  synchronized between translations and thus the calendar at its own, does not
  necessarily uniquely define the entity that was being shown.)
- The visitor fills in the remaining information and submits the complete
  booking form.
- Note: on webform submission, the values that the formlet orignally POSTed will
  not be there anymore. So if you need them during the webform submission phase,
  you need to place them in webform components! (see below)
- The webform module handles the submission by e.g. e-mailing the submission to
  the website or accommodation owner.


Defining the 'complete booking form' webform
--------------------------------------------
This part assumes you are using the webform module.
- Define the webform components that the visitor should complete like name,
  e-mail, address, number of persons, etc.
- Define webform components for the dates that are already filled in:
  - Begin date (default value: %post[from_display]): the begin date.
  - End date (default value: %post[to_display]): the end date.
  or
  - Begin date (default value: %post[from_iso]): the begin date.
  - end date (default value: %post[to_iso]): the end date.
  These will typicaly be disabled textfields, the visitor can not change the
  dates anymore as the availability calendar is not visible on the webform.

  The difference between these 2 sets of dates are:
  - The latter are in the ISO 8601 (date part only) format: yyyy-mm-dd, while
    the former are in the format as presented to the visitor. You can define and
    localize this format via the Drupal admin interface at
    admin/config/regional/date-time(/locale).
    Note that this may lead to different date representations for the same date
    depending on the *visitor*, not the *recepient* of the webform!
  - For overnight calendar fields, the to_iso date is the last full day of the
    rental period, while the to_display date is the departure date.
- As you will typically post to the same webform for all accommodations, you
  need to know from wich accommodation the request was coming. To this end, you
  may want to define additional webform components that receive this information
  needed to process the boooking:
  - cid (default value: %post[cid]): the calendar id.
  - calendar label (default value: %post[calendar_label]): title of the calendar
    (if set).
  - entity type (default value: %post[entity_type]): the entity type.
  - entity id (default value: %post[entity_id]): the ID of the entity.
  - entity label (default value: %post[entity_label]): the title of the entity.
  With the exception of entity label and/or calendar_label, these will typically
  be hidden fields as the visitor does not have to see this information.
  Note that in a multi-lingual site, a calendar may be synchronized over all
  translations of an enity. So there is not necessarily a 1-to-1 relationship
  between the calendar and the entity.
- Fields from the POST that you don't need, don't have to be defined as a
  webform component.
- You may also have fields from the POST that you only need for internal
  processing, but do not want to send in the e-mail. You should declare those
  fields as webform component and, subsequently, you can exclude them from the
  e-mail in the "Edit e-mail settings" page of the webform module.


Hooks for custom processing
---------------------------
Depending on your situation, processing the webform may need some additional
programming from your side. Think of extracting the name of the accommodation
from the entity, or getting the e-mail address to send the reqeust to. The
webform module and the mail system offer hooks for this.

1) The webform to complete the booking is used for multiple accommodations and
you want to change the e-mail addres to which the webform submission is sent

2) On submission, you want to update the calendar and set the requested dates
to "Optionally booked".

ad 1)
See issue http://drupal.org/node/1470490

ad 2)
See issue http://drupal.org/node/1379384

File

booking_formlet/README.txt
View source
  1. /**
  2. * README for Availability Calendar Booking Formlet module.
  3. *
  4. * @author Erwin Derksen (fietserwin: http://drupal.org/user/750928)
  5. */
  6. The availability calendar booking formlet module defines a booking formlet
  7. field that cooperates with Availability Calendar fields. It offers a small form
  8. that can receive an arrival and departure date by reacting to click events on
  9. Availability Calendar fields. If both dates are filled in, the submit button is
  10. enabled and the user can continue to the real booking form.
  11. This form is called a formlet as it is a small minimal form that only receives
  12. the arrival and departure dates. The full booking form, where the visitor can
  13. enter his/her name and other details is to defined separately. Think off an "Add
  14. to cart" form where one can enter the quantity and click on "add to cart" which
  15. brings you to the full cart form.
  16. Dependencies
  17. ------------
  18. This sub-module depends on the Availability Calendar module.
  19. Also the form will typically be posted to a webform. So installing the webform
  20. module is recommended.
  21. Limitations
  22. -----------
  23. This module will not:
  24. - Change the calendar. When clicking on the departure date the calendar will be
  25. updated visually, but this change will not be stored on the server. You can
  26. define a hook for that. See e.g. the webform documentation to find out which
  27. (submission) hooks best fit your needs.
  28. - Define the webform. This depends to much on your specific situation.
  29. - Offer payment integration.
  30. Installing
  31. ----------
  32. As usual.
  33. Configuring
  34. -----------
  35. After enabling the module:
  36. 1) Define the date formats you want to use on admin/config/regional/date-time.
  37. You can localize these formats in admin/config/regional/date-time/locale.
  38. 2) Add a webform to post the form to. See the details below.
  39. 3) Add an "Availability Calendar Booking formlet" field to the entity type that
  40. also has an "Availability Calendar" field. Fill the "URL to continue the
  41. booking" field with the URL of the webform created in step 2.
  42. 4) Set the display settings on the "Manage display" page.
  43. 5) Style the form as you like. Note that this module only contains some basic
  44. styling for the formlet.
  45. Basically this is it. Additionally you may want to define some webform
  46. submission processing. This will be explained further on.
  47. Views integration
  48. -----------------
  49. Suppose you have defined a view that searches on availability. The results page
  50. shows the teasers of the entities that are available during the defined period.
  51. Why not present just the "book now" button and allow the visitor to directly
  52. go to the complete reservation form?
  53. This is possible. You can define default values for the begin and date that can
  54. come from some contextual variable. The results page of the search will probably
  55. have a URL that looks like
  56. search-availability?available[arrival][date]=2012-07-01&available[duration]=2
  57. You can tell the formlet to take the begin date from $_GET, more specifically
  58. the entry available[arrival][date] and that the end date should be based on a
  59. duration (in days) given by the available[duration] entry of $_GET.
  60. You can define this in the display settings for a given display mode. So, the
  61. settings can differ for the full view, where visitors will still have to click
  62. on the calendar before they can proceed to the complete reservation form, and
  63. the teaser, where visitors can directly click on "book now".
  64. How it works
  65. ------------
  66. There seems to be quite some confusion about the why and how of this module. So,
  67. following is a bit more in-depth explanation of the ideas behind this module.
  68. Normally the page with the calendar is quite stuffed with all sorts of
  69. information. Thus adding the complete booking form is not desirable. Therefore,
  70. just a small form (aka 'formlet') is rendered that only contains the most basic
  71. fields to allow it to interact with the calendar. Once this information is
  72. completed by the visitor, it can be forwarded to the complete booking form.
  73. Step by step:
  74. - A visitor arrives at your site and, hopefully, eventually at the page with the
  75. Availability Calendar.
  76. - The Availability Calendar module renders the calendar and defines the
  77. javasript that allows the visitor to click on available dates.
  78. - This module adds the 'formlet' to that page including some javascript to
  79. handle the date click events and place the selected dates on the formlet.
  80. - When the user clicks on "Book this resource ..." all information is POSTed to
  81. another page. This page is defined in the field settings and normally points
  82. to a webform with the real booking form.
  83. - Together with the arrival and departure dates, a lot of hidden fields are
  84. submitted. These hidden fields contain information about the calendar field
  85. and the entity the calendar is attached to. (Note that calendar fields may be
  86. synchronized between translations and thus the calendar at its own, does not
  87. necessarily uniquely define the entity that was being shown.)
  88. - The visitor fills in the remaining information and submits the complete
  89. booking form.
  90. - Note: on webform submission, the values that the formlet orignally POSTed will
  91. not be there anymore. So if you need them during the webform submission phase,
  92. you need to place them in webform components! (see below)
  93. - The webform module handles the submission by e.g. e-mailing the submission to
  94. the website or accommodation owner.
  95. Defining the 'complete booking form' webform
  96. --------------------------------------------
  97. This part assumes you are using the webform module.
  98. - Define the webform components that the visitor should complete like name,
  99. e-mail, address, number of persons, etc.
  100. - Define webform components for the dates that are already filled in:
  101. - Begin date (default value: %post[from_display]): the begin date.
  102. - End date (default value: %post[to_display]): the end date.
  103. or
  104. - Begin date (default value: %post[from_iso]): the begin date.
  105. - end date (default value: %post[to_iso]): the end date.
  106. These will typicaly be disabled textfields, the visitor can not change the
  107. dates anymore as the availability calendar is not visible on the webform.
  108. The difference between these 2 sets of dates are:
  109. - The latter are in the ISO 8601 (date part only) format: yyyy-mm-dd, while
  110. the former are in the format as presented to the visitor. You can define and
  111. localize this format via the Drupal admin interface at
  112. admin/config/regional/date-time(/locale).
  113. Note that this may lead to different date representations for the same date
  114. depending on the *visitor*, not the *recepient* of the webform!
  115. - For overnight calendar fields, the to_iso date is the last full day of the
  116. rental period, while the to_display date is the departure date.
  117. - As you will typically post to the same webform for all accommodations, you
  118. need to know from wich accommodation the request was coming. To this end, you
  119. may want to define additional webform components that receive this information
  120. needed to process the boooking:
  121. - cid (default value: %post[cid]): the calendar id.
  122. - calendar label (default value: %post[calendar_label]): title of the calendar
  123. (if set).
  124. - entity type (default value: %post[entity_type]): the entity type.
  125. - entity id (default value: %post[entity_id]): the ID of the entity.
  126. - entity label (default value: %post[entity_label]): the title of the entity.
  127. With the exception of entity label and/or calendar_label, these will typically
  128. be hidden fields as the visitor does not have to see this information.
  129. Note that in a multi-lingual site, a calendar may be synchronized over all
  130. translations of an enity. So there is not necessarily a 1-to-1 relationship
  131. between the calendar and the entity.
  132. - Fields from the POST that you don't need, don't have to be defined as a
  133. webform component.
  134. - You may also have fields from the POST that you only need for internal
  135. processing, but do not want to send in the e-mail. You should declare those
  136. fields as webform component and, subsequently, you can exclude them from the
  137. e-mail in the "Edit e-mail settings" page of the webform module.
  138. Hooks for custom processing
  139. ---------------------------
  140. Depending on your situation, processing the webform may need some additional
  141. programming from your side. Think of extracting the name of the accommodation
  142. from the entity, or getting the e-mail address to send the reqeust to. The
  143. webform module and the mail system offer hooks for this.
  144. 1) The webform to complete the booking is used for multiple accommodations and
  145. you want to change the e-mail addres to which the webform submission is sent
  146. 2) On submission, you want to update the calendar and set the requested dates
  147. to "Optionally booked".
  148. ad 1)
  149. See issue http://drupal.org/node/1470490
  150. ad 2)
  151. See issue http://drupal.org/node/1379384