2

Resolved

Menu Import Duplicates

description

Running a recipe or import/export multiple times will import the Menu's many times causing multiple menus with the same name.

I've investigated this further and the issue lies with a missing IIdentityResolverSelector for "name"
<Menu Id="/name=Main" Status="Published">
      <CommonPart />
      <TitlePart Title="Main" />
    </Menu>
The simple fix would be to create a Menu IIdentityResolverSelector there is one small issue though. The MenuHandler defines the identity of a menu as "name" this is a bit generic and may cause issues in the future it should really be changed to "menu" although this may cause backwards compatibility issues.
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
            if(context.ContentItem.ContentType != "Menu") {
                return;
            }

            context.Metadata.Identity.Add("name", context.ContentItem.As<TitlePart>().Title);
        }
Another fix would be to attach an IdentityPart to the ContentType Menu, although this is probably not the correct fix.

https://orchard.codeplex.com/discussions/452174

comments

sfmskywalker wrote Aug 5, 2013 at 12:55 AM

I think it makes sense to attach the IdentityPart to the Menu type, because otherwise we would have to implement something similar as part of MenuPart (e.g. store a GUID to uniquely identify it).

sebastienros wrote Oct 19, 2013 at 1:21 AM

Fixed in changeset b2761dcd13334a2553f4b1b670bca0dd4a7d236a