Sorry this new article took me some time, you know… also computer geeks needs to go snowboarding :-)
This is the first of a set of discussion about tweaking TouristWay standard booking wizard to better match the characteristics of specific type of offer and products.
First of all let me point out that, in my opinion, TouristWay’s PACKAGE model is the best way to handle tickets, mini-tours, sightseeings and anything is not strictly accommodation.
Don’t get confused by the name, package can be used to create independent single-service products without you having to involve anything else from your catalogue (see also http://support.touristway.com/forums/44926/entries/95482).
The plus of packages against TW’s other models is that you can show your users since the search results a set of alternative variants of your offer. Each variant share the same availability but can have pre-selected lenght of the stay and use different pricelists. Example:
- 1-day / 2-days / 3-days excursions
- weekend trip / working day trip
- monday tour / sunday tour
As usual you also have the ROOMS tab which allows you to define one or more “accommodation” options. Again, don’t get confused by the word “rooms”, here you can load as well any alternative treatment your offer includes.
Example:
- 9:00am excursion / 2:00pm excursion / 9:30pm night excursion
- 20km round / 40km round
- bus+boat sightseeing / bus only sightseeing
- private instructor / join a group
The behavior set in our standard templates takes the visitor through 3 steps: select the type of accommodation, select the number of people and their age, display the quotation.
This is obtained by calling 3 methods of the component in charge for package reservations. The component is called ‘package’ and receives at each step more and more information (input) until all user preferences (dates,rooms,people,age) get collected and the exact quotation can be calculated and displayed.

Let’s say you sell tickets for a sightseeing or places in your Kiteboarding classes, you probably don’t need to know what’s your customer age as it’s irrelevant for pricing and availability.
Our goal will be to remove the 2nd step and skip to the quotation assuming that each unit selected in the first step just represents one person.

Here are the operations we need to complete.
- modify the “n. of rooms” listbox to become a “n. of people” listbox
- change the method called by the first step of the wizard from ‘arrange’ to ‘select’ in order to jump straight to the quotation
- adapt validation rules to send the user to the 1st step (instead of 2nd) if any trouble raise in the once-3rd step.
Switch on your TouristWay Workbench (‘templates’ menu), go to the first step of the reservation (checkinp.cgi, list of alternative rooms/accommodations) and tap into the component XML configuration by clicking ‘page: edit’ in the workbench box.
Locate the component “package” and remove its method ‘arrange’ we no longer need:
<components>
<component id="package" class="package">
[...]
<action id="arrange">
[...]
</action>
[...]
You now remain only with the standard attributes plus the method ‘select’.
To make sure that, in case of validation errors, the ‘select’ method correctly send the user back to the default method (and not ‘arrange’ as previously), let’s modify the redirection rules from:
<validation>
<notify class="any">
<onfailure>SWITCHCALL:do=package.arrange,....</onfailure>
<onsuccess>REDIRECT:%-global.scriptname.booking-%</onsuccess>
<aftercomponent>1</aftercomponent>
</notify>
</validation>
to this slightly different one that calls the default method (do=) in case of troubles:
<validation>
<notify class="any">
<onfailure>SWITCHCALL:do=</onfailure>
<onsuccess>REDIRECT:%-global.scriptname.booking-%</onsuccess>
<aftercomponent>1</aftercomponent>
</notify>
</validation>
Confirm your modification with “PUBLISH” button and that’s all about the XML part.
Now, note the attribute <selfares>, this is the element that receives all the information about the selected number of rooms, people and their age.
The next step will be about adapting the listbox to send all these details to <selfares> in one shot thereby skipping the 2nd step.
As listbox are part of the HTML template let’s go right in (workbench ON!) by selecting the component that draws the availability planner. Click anywhere on the planner and use the link “template: edit” in the workbench box.
Find the part that displays the list of alternative accommodations, we need the <SELECT> tag that displays the listbox:
<SELECT name="selunits[].req">
<%SNIPPET lboxnumeric 0,%-fare.unitbreakdown.availability.nbookable-%,0/>
</SELECT>
All we need to do here is add the information that allows our package component to figure our the number of people (1 per room/unit)
<INPUT TYPE="hidden" class="hidden" name="selunits[].paxplan.b0" value="1">
<SELECT name="selunits[].req">
<%SNIPPET lboxnumeric 0,%-fare.unitbreakdown.availability.nbookable-%,0/>
</SELECT>
The first INPUT tag does the trick by forcing in the pax plan 1 person in the class b0 (=adults).
Last but most important, we need to switch the method called by this template from ‘arrange’ to ‘select’.
This job is up to the buttons at the bottom of this same template, the HTML should look like:
<INPUT type="submit" class="button" onclick="document.getElementById('action').value='package.arrange,pickplan.arrange,pickextra.arrange,pickspecial.arrange';" value="{{proceed}}">
Just replace the whole list of ‘arrange’ with just one ‘package.select’.
<INPUT type="submit" class="button" onclick="document.getElementById('action').value='package.select';" value="{{proceed}}">
Confirm the modification with “PUBLISH” button and you are ready to test your 1-click wizard.
- Stefano