I am attempting to program my first Drupal module, which will be a full featured classified ad system, and I would like some advice from more experienced programmers on how to implement a certain feature.
I will obviously have a classified ad node (I think I am leaning with cck to create nodes), and all classified ad nodes will have certain fields (such as title, price, description, seller email, etc). My classified ad system will also be powered by a hierarchy taxonomy. Now certain classified ad nodes will need specific fields added to them.... so while a automobile and apartment for rent will have the same basic fields, they will both need to have specific fields for themselves. An automobile will need an engine, make, model, etc field, while an apartment for rent will need other fields, like off-street parking, laundry facilities, etc.
Now what would be the best way to implement this? I could make a separate content type for each item... but that seems redundant. I was thinking of setting a table where I can define extra attributes, and to which taxonomy tid(s) they apply to. Then I would create another table of values for all these extra parameters. They would have a attribute_id_field, nid, and a value. Then when a classified ad node gets called, I would go to the database, figure out what attributes I need to add, and add them. That way, with this system, the classified ad administrator can redefine what types of attributes apply to a tid. Any flaws, or something I am overlooking?
1 year 24 weeks ago