Hi ! I need to automatically assing a taxonomy term to a node based on its zipcode (field). What would be the best solution to accomplish it ?
Thanks !
Hi ! I need to automatically assing a taxonomy term to a node based on its zipcode (field). What would be the best solution to accomplish it ?
Thanks !
Implement hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL)
for $op == 'presave'
in a custom module.
YOURMODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($op == 'presave' && $node->field_zipcode);
{
$term = zipcode_get_term($node->field_zipcode);
$node->taxonomy[$term->tid] = $term;
}
}