First off, this is a great module, nice work.

Looking at the export file the plid is exported correctly, but mlid is always 0 for every node, so upon import, the hierarchy isn't built correctly and in my case some of the pages were becoming children to admin_menu links because the plid matched a previously existing mlid.

I know that there is an option to wipe out the imported menu links, but when importing about 200 pages nested about 4 levels deep, trying to rebuild the hierarchy by hand can be quite time consuming. So hopefully there is a fix to maintaining the hierarchy upon import.

Thanks.

CommentFileSizeAuthor
#5 node_export_menu.zip3.77 KBshawn_smiley
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danielb’s picture

I am not aware of a solution to this. This module isn't designed to export a whole site structure - the bulk functionality is kind of an afterthought and a lot of things like book and menu structures, and reference fields, do not get imported properly on the new site.
If you have a good understanding of drupal's api, database, menus, etc.. you might be able to think of a way around this, if so... let me know how :P Imagine if you forget to export one node in a hierarchy - what happens to the hierarchy? It seems like you would need a totally different approach to the whole export - you might write a module to export the menu structure, which would use node export to attach the nodes into it's own export. Or perhaps an option to node export to 'also export dependencies' or soemthing like that and it would add in any nodes you forgot.

danielb’s picture

Title: Menu hierarchy not imported correctly » Handle menu hierarchy
Category: bug » feature

This is closely related to http://drupal.org/node/601458 and a suitable strategy to solve one issue may prove effective for the other.

danielb’s picture

Component: Code » Node Export
Status: Active » Postponed
shawn_smiley’s picture

I may have a solution for this.

I'm building a module that allows importing/exporting an entire menu hierarchy to solve a data migration challenge on a site. I think this module would make the most sense being a submodule of node export since I'm borrowing heavily from it anyway. :-)

Basically what the module does is add Import and Export tabs when you're viewing a given menu at /admin/build/menu-customize/menu-name.

The export tab works pretty much exactly as the node export, dumping an array of the menu tree.

The import tab takes that exported menu tree array and iterates over it creating menu entries. It does require that all of your nodes have URL aliases and that the aliases are identical between sites. That's how I get around the issue with the node IDs changing.

I still have a few issues to work out, but should be able to upload some code by the end of the weekend.

shawn_smiley’s picture

Status: Postponed » Needs review
FileSize
3.77 KB

Here is a submodule for handing the export/import of an entire menu tree.

I've attached a .gz of the new submodule. No changes were made to the base node_export module. Just drop this module into the node_export/modules folder.

kruser’s picture

That's awesome. I can't wait to test it out. I'll let you know how it goes.

raven_web’s picture

thank you Shawn_Smiley, your module did exactly what I needed :)

danielb’s picture

Status: Needs review » Postponed

I didn't have much luck with shawn's module. Does it not work if you try to import into the same site?
I would have added it to this project, but apart from checking node export's settings I don't really see how it integrates with this module. The module could be useful for some people, but I don't think it solves the problems of this issue. You could consider creating a new project to further develop/maintain a menu export perhaps.

Summit’s picture

Component: Node Export » Node export

Subscribing, greetings, Martijn

danielb’s picture

Version: 6.x-2.18 » 7.x-3.x-dev

Development of features on this module will now be focused on 7.x-3.x-dev, with backports possible after fixing.

ice5nake’s picture

I wonder if relating this issue with this one might help, Export Menu links with UUID

And this seems like it could offer a potential path forward, UUIDs for Menu Links

moonray’s picture

Just ran into this issue on a site we're developing.

Wouldn't duplicating the functionality of #601458: Handle book structure work here?
@danielb If that's the case, I can write the patch for it. How stable is the code form the aforementioned issue?

danielb’s picture

That code can deal with books because books/nodes are entities. Menus are neither entities or nodes :/

danielb’s picture

I dunno maybe it could still work, it might not have to be an entity.

edmonkey’s picture

I can see there are a few threads about the menu array not being populated on export, has anyone done any patches to enable it to export and import correct menu hierarchy? (using 7.x-3.0 and Feeds)

I'd be keen as to have this ability as I too have a few hundred exports in a nested menu to battle with.

danielb’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)

OK I think we covered that this was mostly out of scope. BTW a lot of the menu issues people are having is just that they didn't turn the setting to import menus on.