The task at hand
Our client, The Consortium (providing educational supplies to schools across the UK) requested the build of a tool that would allow its customers to easily configure and purchase Exercise Books – a process that was previously long-winded and option heavy.
Users of The Consortium website were slightly different to a standard e-commerce purchaser: budgetary constraint means that teachers using the website are not actually making purchases, but rather window shopping for the products they require, the sum of which would be passed on to an individual or department responsible for purchasing to place the order.
This meant the order placer would be processing multiple, pre-specified orders, and required a service that was as efficient and as quick as possible, removing the obstacles of old.
Performance: The vast number of possible attribute option combinations for an Exercise Book (orientation, size, number of pages, colour, ruling etc.) meant that the process could potentially put tremendous strain on the database when returning the results necessary for the feature to run. Making the page load time fast enough not to frustrate the customer in the order process would then be a challenge, ensuring seamless option elimination as the customer configures each required product.
Non-sequential selection: In Magento, the Configurable Product type allows users to drill down the options sequentially, starting from the first attribute, then the second etc. The client wanted Magento customisation that would allow its customers to start from whichever attribute they wanted and proceed in whatever order they wanted. For example a user might click option 5, Ruling, before selecting option 1, Orientation. This again added to the complexity of the issue.
Generalisation: The tool should be produced in a way that, should it be required, could be easily used for products other than Exercise Books in the future.
How we did it…
We identified the need to create a new Product Type in Magento – we called it the Builder Product. This product was based on the Configurable Product Type, but would allow us to add an extra layer of functionality to target the performance requirements requested, such as the removal of sequential product options.
When a Builder Product is created (or saved), a GRAPH Data Structure is built and added to the database. This GRAPH holds a list of attribute-value combinations and the ‘Associated Simple Products’ to which they apply. Below shows the GRAPH structure we used:
Here’s an example of how it works in relation to the Exercise Book builder:
Colour : Red -> Ruling : 8mm rule with margin = Product IDS: 101,103,110 1
[This particular combination of colour ‘Red’ with ruling ‘8mm rule with margin’ would be given a unique product ID]
The GRAPH structure was chosen due to its simplicity and ability for fast traversal and searching through its branches – hugely beneficial when the customer is configuring the Exercise Book on the front-end.
When the customer starts configuring the Exercise Book by selecting attribute options, the Builder Product determines:
>Which attribute options are still available depending on the customer’s current attribute option choices
>If the customer’s current attribute option selection leads to a single product
To address the issue of generalisation (allowing the same functionality to be used for different products down the line) we chose to bundle the Builder Product together with GRAPH functionality and a single, base extension. This allowed all the logic in this extension to be applied to all product concepts (exercise books, furniture, cars etc.).
Take a look at the finished Exercise Book Builder in action at http://www.educationsupplies.co.uk/exercise-book-selector.