I have a content type that requires me to assemble a URL from several sources - the node title, a taxonomy value, and some fields of a product that are referenced from a product display that this content type references. So:
mynode type
- title
- taxonomy value
- entity ref -> product display -> product field
The entity ref can have one or more products, so there is some logic I need to crunch to assemble the right URL. I didn't have luck doing this through pathauto, so it looks like I need to handle this on hook_node_presave(), which does set my alias, but I get a 404 on that alias, so it seems I'm missing a step.
My code is:
mymodule_node_presave($node) {
if (empty($node->path['alias'])) {
$node->path['alias'] = _some_fx_that_figures_out_url();
$node->path['pid'] = 0;
$node->path['language'] = LANGUAGE_NONE;
}
}
I guess I'm missing something?