Motor State Parts Catalog Administration
Each year Motor State Distributing publishes several different product catalogs, focusing on different segments of the performance aftermarket. Motor State wanted a way to upload their product catalog PDFs and display them on their site, as well as the online stores for dozens of their dealers. There were two parts to this project: the administrative catalog management system and the catalog viewer (Javascript & AJAX). The catalog administration is written using HTML, Javascript, JQuery, AJAX, PHP, and MySQL.
Each product catalog starts as a 250-450 page PDF that is converted into a series of JPG files, each image file corresponding to a page in the catalog. The image files are packaged into a zip archive and uploaded into the empty catalog. Using PHP the zip archive is unpacked and the images moved into catalog directories on the server. Various different versions of the images are created using Image Magick. Once the images have been created, records are created in the database associating the images to the catalog. Just as with the original PDFs, each image becomes a page again in the catalog. Large file uploads can sometimes be a problem, so the application allows for filling a catalog using many smaller zip archives with each subsequent zip archive appending its images to the end of the catalog.
All of Motor State’s product catalogs are built off a product library of roughly 1.1 million products. This library is the backbone of the product catalogs. Each night the product data is uploaded to the application server from Motor State and a server script imports and updates the product data. Every 20 minutes thereafter updates containing inventory data and product status are sent and imported. Through database optimization and script performance enhancements, the import time for the full library was reduced from over 6 minutes to around 45 seconds. The use of temporary tables means having a fail safe in case of an import failure and zero downtime on the site while the import is processing.
Once the images are placed in the catalog the product data can be loaded into the catalog. Motor State supplies two spreadsheets: one contains product-to-page data, the other contains product-category-to-page data. The spreadsheets are then exported into data structures then loaded into the database. Each product in the import file is cross-referenced with the product library to ensure data integrity. No product will appear as a purchasable item in the store that is not actually available in the product library. Once the product data is loaded onto each page the catalog administrator can browse through the catalog pages and see which products appear on each page and correct any errors in the imported data, swap out the images used for the pages, reorder the pages in the catalog, or even remove a page from the catalog entirely.




