I've been tinkering with the PathAuto settings available for Node Hierarchy and am finding some trouble trying to get the child type nodes nested inside the parent node type.

For example:
- Parent node type names are: Game, Movies, Music (These are all seperate parent nodes)
- Child nodes type names are: Cover, Disc

Node Hierarchy seems to set PathAuto to display as: "nameofSPECIFICparentnode/nameofSPECIFICchildnode"
I want it to display like the following: "parentnodeTYPEname/nameofSPECIFICparentnode/childnodeTYPEname/nameofSPECIFICchildnode"

If my site had a DVD, for example, Spider-Man. Rather than "movies/spider-man/cover/north-america" it outputs "spider-man/north-america".

Because the Cover and Disc nodes are used for a range of different parent type nodes, I can't simply add a static "game" as a prefix as that would cause issues with the child nodes properly outputting URL's for "movies" and "music".

Comments

mr_dimsum’s picture

Hope I described the issue clearly.. Hopefully it isn't too ambiguous!

Thanks again Ronan! Amazing module.

ronan’s picture

First set the pathauto setting for the parent node type to '[type-name]/[title]' and then set the type for the child type to '[hierarchypath]/[type-name]/[title]'.

That should achieve the effect you want.

mr_dimsum’s picture

I'm still having some issues with this. The child node links are still not picking up the type name for the parent node.

My parent node PathAuto output is set as: http://www.example.com/game/trauma-center-second-opinion

With the settings provided, I am getting: http://www.example.com/trauma-center-second-opinion/cover/north-america-...

Any ideas anyone?

ronan’s picture

The token [hierarchypath] should insert the url alias of the parent item, so if you're using that token it should be creating the situation you're looking for. Try opening and saving your child node to make sure pathauto recreates the paths. If this token is not working, then set this issue to 'bug report' and layout the steps needed to reproduce the bug. (Make sure you list exactly what your pathauto settings are for each of your node types.

Thanks

mr_dimsum’s picture

After a bit of experimenting, I've determined the issue. In fact, the code provided by Ronan does work.. Up until this point, I have been experimenting with the Node Hierarchy PathAuto terms by deleting all the URL aliases generated by PathAuto and just bulk generating them again.

This, as it turns out, was the cause of the problem. Even if they are bulk generated and I use the supplied code above, I will be getting to different results. With the code Ronan supplied, when I was using bulk generation, it seemed to note pick up the parent node type names, and this was essentially the cause of the problem.

As a result, all previous nodes will have to somehow be resaved or deleted and re-posted to get the correct results. At this time, I am not sure what is the cause of the problem (whether it is Node Hierarchy or PathAuto specific).

ronan’s picture

I wonder if, when bulk updating, pathauto is processing the children before the parents. If this were the case, you would be getting incorrect results since the urls for the children depend on the url for the parents being already created.

Just a thought. Glad you got it figured out

All the best

summit’s picture

Subscribing, greetings, Martijn

dgorton’s picture

Status: Active » Closed (fixed)

Closing per cause in #6 (bulk updating and doing children before parents will cause this.)
Closing as is very old issue w/ very old code. Please reopen if still relevant.