Wellington Motorcycles

Company

Wellington Motorcycles use a stock management system for internal management of their extensive range of stock; but, they also need to display the stock they currently hold on their Drupal website - for fairly obvious reasons. Web Industries didn't build the website itself, but got called into give it a general technical tidy-up and audit, plus do some of the tricky stuff.

Unfortunately, their stock management system doesn't have an API, so it was taking them hours and hours each month to keep their website stock maintained.

However, their stock management system does provide a file export - a Zip which includes an XML file containing all of the stock dteails, along with multiple images associated with each stock item. So, they gave us a bell and asked to develop a module to import this into their Drupal website.

Getting the XML into the site was pretty straight forward, and although a bit of work was involved in associating multiple images with each stock node, it wasn't a major.

This is what happens:

  • The stock management system delivers the Zip to a specified folder in the website file structure,
  • On cron we automatically poll a directory folder for a new import file, if there's one there we import it, or, a user with the relevant permission can visit an administration page, and select which file to import - they are, of course, ordered with the most recent at the top for usability,
  • On cron, or the user clicking th 'Update stock' button, the process runs - it only takes 30 seconds or so,
  • Any stock item which exists in the XML and is already present on the website is syncronised to ensure up-to-date information,
  • Any stock item which exists in the XML and is not present on the website is created,
  • Any stock item which does not exist in the XML but is present on the website is deleted,
  • The import details to are written to Watchdog for logging, and an email notification is sent to the site administrator to confirm everything is done.

And that's it - simple! For approximately 25 hours work we managed to take a process which was taking over 20 hours per month (in reality, it was taking so long that it was often not being done at all!), and turn it into something which could be done within a minute - how cool is that!?

Drupal version