Sonny has just committed a very promising feature that introduces the concept of product properties. Think of it as “free tagging” but with a little bit of structure to keep things sane. Products can now have an arbitrary number of name-value pair properties which can be used for a variety of purposes. The first possible use would be to build a product taxonomy in an automated fashion. Product taxonomy is a feature that Sonny is still working on and we’re hoping to see it in a few more days.
Another interesting use for product properties is to assist with a taxation extension. I plan to use this in the current TaxCalculator and the upcoming VAT Calculator to help determine the taxability of a product. For instance, in certain U.S. states, clothing is not taxable. By introducing a tax category property for all products you can create your own rules about what gets taxed. In the case of our clothing example, you simply create a property of “tax category” and assign it a value of “clothing.” In your tax calculations you can then check for items that are clothing and exempt them from taxation.
We have also introduced the concept of a product prototype. The prototype is basically a template of properties that can be assigned in bulk to a product. For instance, you might want to construct a prototype called “Shirt” which would contain the following properties: Brand, Style, Fabric, Gender, etc. This way every time you added a new shirt product to your store you could say “use the shirt prototype” and you would get all of these properties assigned to your new product at once. The properties will be empty, however, so you still need to specify the values of these properties for each product.
Properties are useful for business logic that needs to check from a finite list of values. They are not a substitute for product taxonomy (which requires several levels of nesting) but they can be used to assist in the generation of taxonomies. They can also be used to allow for navigation by “tags” and provide a structured mechanism for keeping the universe of tags somewhat organized.
Currently there is no way to limit the values of your properties. For instance, if you had a property for “Gender”, there is no way to limit the choices to just “Men’s” and “Women’s.” We’re considering implementing an option to specify that a property has a known list of values but right now, its free text.
The code is currently available in Github and you can also experiment with it on the demo server. The interface is a little bit rough around the edges but you will get the idea. Please post any and all feedback to the spree-user mailing list of course.