Raileasy is a site for booking train tickets on-line, they provide several ticketing services such as single way travel, return travel and they are beginning to expand into Eurostar and hotel accommodation.
As well as running a front-facing website for customers, they also provide an affiliate system where other websites can earn commission by implementing the Raileasy affiliate script into their website, the affiliate script was a bit of a challenge because it all had to be set-up through JavaScript to make it as simple as possible for the affiliate to implement the script into their browser.
When I was first given this project there was already a system in place, but it was buggy and some required features were missing. Once of their biggest problems was compatibility with clients websites, on some sites the script worked flawlessly, but on others it would not work at all.
My first task was to identify the issues and correct them, it became obvious quite quickly that the main problem was JavaScript library clashes, the affiliate script relied heavily on jQuery and some other bespoke JavaScript files. I started by changing all function names in the bespoke files so there was absolutely no way function names could clash with other systems.
To fix jQuery however required more work, firstly I updated jQuery to the latest version and correct any obsolete / deprecated code, I then implemented jQuerys noConflict() and changed the code accordingly. Finally there was a big problem where the client's website might already be implementing jQuery, for this I simply setup a "flag" so you could tell the system not to re-include jQuery if required.
My second task was to make some improvements to the existing code, firstly railcard options were missing, Raileasy wanted links for next day, tomorrow, same day and etc. Also they wanted to be able to allow affiliates to change the theme as and when they required.
I made the system even more flexible by assigning flags so affiliates could disable/enable many of the features displayed to their visitors such as the default railcard option, inward and outward default dates, default origin and destination stations and much more.
Here are some screenshots of the script running on some websites.
During the implementation of all the changes, I was shocked to realise there was no user guide to pass on to affiliates when setting up their code. So I decided to create one as I had not only added many new parameters so affiliates can modify the workings of the script without them having to pry information out of the company through emails and phone calls. I have attached the document below.