Posted in Development
This month we have completed our UK Vehicle Data API integration into Magento 2.
We launched the Magento 2 site for our clients AirbagTeam earlier this month and have been working on a custom integration module for checking vehicle registrations.
We scoured the web for a few weeks to try and find a suitable integration to link a vehicle registration plate checker to match parts inside Magento to no avail. We spoke with the DVLA and many other API providers but couldn't find anyone that had a Magento integration available, so we decided to build one!
To start with we sourced a data provider who had a detailed API connection with many custom strings. After searching and testing we found UK Vehicle Data had the most suitable API for our custom module.
Once we got the integration to the API working, this allowed customers to search their registration number on Magento and it would return key information about their car. This was the easy bit! We then needed to link this car information to the category of products, and in this case that's more than 21,000 products.
We tried and tested numerous ways to do this, testing years, models and VIN numbers, however this was trickier than we thought as various parts can fit various cars from a range of years. Back to the drawing board to re-think how to go about it. We noticed that UK Vehicle Data have a database of codes called UVIDs which are unique to a set amount of vehicles on the road. This worked for us, so the next step in the development continued.
We created a custom attribute set of UVIDs which could be assigned to products. This was now a reverse process because a product could have up to 300+ UVIDs assigned as one part could potentially fit 300+ types of models. We created an attribute import and export module to make it easier to upload this huge bank of UVIDs (120,000+ to begin with!). Once this was imported we then created a formula to add these to the product import so multiple UVIDs were added to the product entity ID attributes table.
This set the backend of Magento up perfectly to allow this new assignment. The final thing was to create a process after the customer enters their registration to pull the UVID from the API, create a custom search through our module and then present all of the products associated with that unique UVID ID.
This took a while for us to get working fully but once we did it was great. We have spoke to UK Vehicle Data about advancing on this development and packaging it up to be available on the Magento Marketplace in the very near future.