By Peter Bell

Product Attributes

So, what would be a good generic way to implement product attributes? Here is how I’m currently doing it. Any better ideas or approaches would (as usual) be gratefully received!

Firstly I provide an application wide Attribute manager allowing site admins to create new attributes (color, size, Initials, etc.). Each attribute has a field type (text box, drop down, radio buttons, etc.), an optional default value, the ability to be "required" and (for field types that need it) a text box for entering a comma delimited list of option values.

I'm not a huge fan of using a comma delimited list of values as it doesn't support the case where the values saved should be different from the captions displayed, but I’ve found from experience that most of my clients don’t need that and they prefer the speed of a single attribute admin rather than the flexibility of a separate "list/add/edit/delete attribute options" system. That might change when I get around to Flex or AJAX enabling my admin generator and the cost of a round trip drops.

The next step is to allow for some or all of the attributes to be associated to a given product. I have tried two approaches. With one there is a "use attributes" yes/no radio button on the product admin form. Selecting yes then displays a list of attributes that can be selected using check boxes and then a final screen lists the option values for any attributes that have a value list so the admin can select a subset of options (maybe this product only comes in red, green and blue) and can associate incremental prices and/or weights at a product level. I have tried putting the list of attributes straight onto the first product screen, but while it saves a round trip, admins have told me they find it slower to try to select from a long list of attributes in a drop down box – they prefer the extra screen and the relative speed of selecting a set of check boxes.

In terms of data storage, the attributes are stored in a ProductAttribute table. The attributes for a given product are stored in a ProducttoAttribute table, and the attribute options for a specific product are stored in a ProducttoAttributeOption table which also stores any additional costs or weights.

In terms of display, I just publish a simple form for each product ID which is then included by the product detail view using a generator template that can be customized for a given application (or could be customized for different types of products if that granularity was required.

Related Blog Entries

Comments
Peter, I am currently implementing a very very similar system, IM me if you want at my email on Gtalk and we can talk through some of your stuff.

Regards

MD
# Posted By Mark Drew | 8/18/06 12:30 PM
Would be lovely to see som screen shots from your work.
# Posted By Martin | 8/24/06 11:49 AM
With this method, is it possible to keep track of specific SKU inventory qtys?
# Posted By Will Tomlinson | 7/5/07 7:08 AM
@Will, Nope. That's something I covered in another posting distinguishing product attributes from "master products" where you have one record per SKU:
http://www.pbell.com/index.cfm/2006/8/18/Ecommerce...

That said, I have seen systems where you can hack some kind of per attribute combination inventory info, but to me, if you need inventory data on unique combinations, you need to have one line item per unique SKU. If you have that need, you might wonder how anyone could get away with product attributes, but for some use cases where product lead times are low, there is no physical inventory requirement, or where it is better to take the order for something you don't have and then cross sell than to lose the sale, it makes sense. Also, if you want to do a kitting style solution where the user picks the pieces and then puts them together, product attrbutes is much simpler than a true MRP kitting system. Many of our smaller clients just don't have the time required to enter every possible SKU into a system - those with a decent ERP system usually have that data already so for them we often recommend master products.
# Posted By Peter Bell | 7/5/07 12:05 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.