The last month of my life has been coding a whole new site for waggonersboots.com. I’ve moved everything over to PHP5, using PHP Classes, MySQLi, normalized tables, and a rough version of the Model-View-Controller system.
When dealing with footwear, you have to have shoe sizes, and other products have colors. I could have codeed different variations for products to have sizes, and others to have colors, and any other variations that would have come along, but to avoid the extra coding, I implemented them as one idea:
- The product table contains generic information about a product, such as a brand, stock number, title, prices, category, and so forth.
- The item table contains one instance of a product. The item is what actually gets sold and is tied to the shopping cart. Items have unique variations, which allows for a product to have multiple items.
- The variations table has variations with a name and value. To keep the tables normalized, there is a item_variations table which join the two together, allowing an item to have multiple variations, and an item to have multiple variations (forcing a unique variation name, such as “Size” on an item).
The products have a product type, and I’ve been toying with the idea of letting variations be type specific, so that products that are footwear, can have the Size 8.5 D, 9 D, 10 D, and products that are apparel can have the size 32×32, 32×34, Medium, Large; this is kind of contaminated too, as Jeans, Shirts, and Hats have their own systems of sizing.
This method causes a few problems when trying to turn the results from the database into a web interface, but I got it to work. I may post some code later.