How do I automatically assign taxonomy term(s) to a newly-created node?

As an example, I have a price field in my node, and taxonomy terms such as "0-100", "100-200", etc.
I'd like to assign the taxonomy term "0-100" to nodes created that have a price between $0 and $100, "100-200" for nodes with prices between $100 and $200, etc.

Is this possible with any current modules, or how have others implemented this functionality (surely others have done something similar...)?

Comments

vijaythummar’s picture

I think there is no any ready made module for auto assign taxonomy terms to node. But suppose you are developer then you can achieve this functionality based on hook_nodeapi.

In hook_nodeapi, you have to do coding in case "insert" where you can assign the taxonomy to particular node.

Thanks,
Vijay

Thanks,
Vijay Thummar

yakker’s picture

Just to add my voice to this string!
;)
Would love the ability to auto-assign terms from an existing vocabulary to nodes when they are created with "add content" of a particular content-type.

Cheers!
Chris

melchoir55’s picture

Taxonomy defaults only assigns tax terms based on node type. It doesn't consider properties of the node (such as sell price).

I also need to accomplish what the OP was asking. Does anyone have any suggestions?

Anonymous’s picture

Wow, this brings back memories... :)
Unfortunately though, I can't remember how I ended up getting around this problem.

If I were to do something similar today though, I would definitely use a hook_nodeapi() type solution.
Simply create a custom module (or add to an existing one) and implement hook_nodeapi(). I would use the 'presave' operation for assigning a taxonomy term, and I think you'd probably also want to use the 'update' operation too (if/when the price is ever changed).

Hope that helps!