
Case Study: E-commerce Site - The Catalog
Ecommerce Site Makeover 4
Once the database changes were implemented, I began creating the catalog templates, which replaced all the separate HTML pages in the original site.
When a customer selects a product category, they are taken to a page showing thumbnails of the products within that category. The page generates its content by querying the database for a list of product numbers, and generating code to make links and display thumbnail images for each. Each link is unique, and can be bookmarked or spidered by search engines.
When a customer selects an individual items, another template queries the database for information about that specific product and creates a page for it. The page url is rewritten using an .htaccess file to redirect to the single product template file, but appears to be a unique url and can be bookmarked or spidered. This page includes customized meta-data generated from information in the database, a full-size image, the product description, other information (depending on the product category or user options) and links allowing the customer to add it to their shopping cart or post it to Facebook.
With all product information in a database, it was very easy to add a search function to the site, which the original site lacked. Search results are displayed using a third template, and carried over to the product page if a customer clicks on an individual product. This allows them to view the details for any product found by their search without needing to run it again.
Using the database to generate catalog pages as well as order form pages solved several other problems. Now updates and new products appear in both sections of the site without the need to create separate HTML files for each item. Pricing is always consistent; prices on the order form always match prices on the catalog pages. And since the order form is fully integrated into the rest of the site, it shares stylesheets that make it look like part of the same site, and overall code overhead and maintenance is reduced through use of shared functions.