本文转自:http://docs.nopcommerce.com/display/nc/How+to+code+my+own+shipping+rate+computation+method

Go to start of metadata

 

In nopCommerce, administration menu is build from the Sitemap.Configuration file which is located in Nop.Admin folder.

To do the same, you can use following sample code which you need to add in your plugins’ cs file. First, implement IAdminMenuPlugin intereface in your plugin main class. Then,

public void ManageSiteMap(SiteMapNode rootNode)
{
    var menuItem = new SiteMapNode()
    {
        SystemName = "YourCustomSystemName",
        Title = "Plugin Title",
        ControllerName = "ControllerName",
        ActionName = "List",
        Visible = true,
        RouteValues = new RouteValueDictionary() { { "area", null } },
    };
    var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
    if(pluginNode != null)
        pluginNode.ChildNodes.Add(menuItem);
    else
        rootNode.ChildNodes.Add(menuItem);
}

You can also put any security (ACL) logic to this method. For example, validate whether current customer has "Manage plugins" permission.

In version 2.00-3.50 you should do it the following way:

public bool Authenticate()
    {
        return true;
    }
  
 public  SiteMapNode BuildMenuItem() // SiteMapNode is Class in Nop.Web.Framework.Menu
    {
        var menuItemBuilder = new SiteMapNode()
        
            Title = "Title For Menu item",   // Title for your Custom Menu Item
            Url = "Path of action link", // Path of the action link
            Visible = true,
            RouteValues = new RouteValueDictionary() { {"Area", "Admin"} }
        };
  
     var SubMenuItem = new SiteMapNode()   // add child Custom menu
        {
            Title =  "Title For Menu Chile menu item", //   Title for your Sub Menu item
            ControllerName = "Your Controller Name", // Your controller Name
            ActionName = "Configure", // Action Name
            Visible = true,
            RouteValues = new RouteValueDictionary() { {"Area", "Admin"} },
        };
        menuItemBuilder.ChildNodes.Add(SubMenuItem);
  
  
        return menuItemBuilder;
         
    }

In the above code, you can find comments where you need to replace values depending on your requirements. Moreover, the above code also explains how you can add a child menu items inside main menu.

[转]NopCommerce How to add a menu item into the administration area from a plugin的更多相关文章

  1. Editor Scripting学习笔记之Menu Item

    主要用到: MenuItem属性 MenuCommand参数 可能用到: EditorApplication类 Selection类 GameObjectUtility类 FileUtil类 Undo ...

  2. -25299 reason: 'Couldn't add the Keychain Item.'

    今天在用苹果官方demo 提供的KeychainItemWrapper类时遇到-25299  reason: 'Couldn't add the Keychain Item.'错误,再4s上可以正常运 ...

  3. Toolbar 和 CollapsingToolbarLayout一起使用时menu item无点击反应解决办法

    昨天一直在琢磨为什么Toolbar和CollapsingToolbarLayout一起使用时menu item无点击放应的原因,后来在stackoverflow上一条回答,说可能是Toolbar的背景 ...

  4. create-react-app 搭建的项目中,让 antd 通过侧边栏导航 Menu 的 Menu.Item 控制 Content 部分的变化

    第一种:BrowserRouter把Menu和Route组给一起包起来 <Router></Router> 标签要把Menu和Route组给一起包起来 修改src/index. ...

  5. could not execute menu item系统找不到指定的文件

    Wamp3.0.6 64bit,系统任务栏图标,左键,Apache菜单,httpd.conf,报错“could not execute menu item.....系统找不到指定的文件” 根据网上的搜 ...

  6. Difference between menu item types; Display, Output and Action in Dynamics Ax

    Difference between menu item types; Display, Output and Action in Dynamics Ax Developers often ask m ...

  7. iOS开发—— Couldn't add the Keychain Item

    报错:*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn ...

  8. cocos2d-x 3.2,Label,Action,Listener,Menu Item等简单用法

    转载自:http://blog.csdn.net/pleasecallmewhy/article/details/34931021 创建菜单(Menu Item) // 创建菜单 auto menuI ...

  9. sampleviewer add menu item error 'assert'

    可以跟踪到 mfc提供的源代码内部,(注:如果打开了mfc源代码,设置了断点,但是跟不进去,那就需要更新PDB文件,具体网上搜)打开 wincore.cpp文件(D:\Program Files\Mi ...

随机推荐

  1. Bringing Whoops Back to Laravel 5

    You might be missing the "prettier" Whoops error handler from Laravel 4. If so, here's how ...

  2. [LintCode]——目录

    Yet Another Source Code for LintCode Current Status : 232AC / 289ALL in Language C++, Up to date (20 ...

  3. 【Java大系】Java快速教程

    感谢原作者:Vamei 出处:http://www.cnblogs.com/vamei Java是面向对象语言.这门语言其实相当年轻,于1995年才出现,由Sun公司出品.James Gosling领 ...

  4. 记一次.NET代码重构

    好久没写代码了,终于好不容易接到了开发任务,一看时间还挺充足的,我就慢慢整吧,若是遇上赶进度,基本上直接是功能优先,完全不考虑设计.你可以认为我完全没有追求,当身后有鞭子使劲赶的时候,神马设计都是浮云 ...

  5. .NET面试题系列[2] - .NET框架基础知识(2)

    3 程序集 面试出现频率:虽然很重要但不怎么出现,可能会考你定义,以及程序集包括什么,然后自然的话题就跑到反射上去了. 重要程度:8/10,很重要 需要理解的程度:知道程序集包括IL和元数据.知道元数 ...

  6. 客服小妹是如何泡到手的——C#定时提醒·语音录制·语音播放·文件转录Demo源码——倾情奉献!

    一.需求提出 客服小妹跟我说,每天要统计新加好友数,得先记下昨天的数目,然后查看今天的数目,还要相减,打字,记录——好麻烦! 又说,客户多的时候,忙起这头忘了那头,文字记录备忘又太费劲! 我说,赐你一 ...

  7. Jquery双向select控件Bootstrap Dual Listbox

    效果预览: 一. 下载插件 github地址:https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox 也可以在这个网站中下载:http: ...

  8. 架构设计:一种远程调用服务的设计构思(zookeeper的一种应用实践)

    在深入学习zookeeper我想先给大家介绍一个和zookeeper相关的应用实例,我把这个实例命名为远程调用服务.通过对这种应用实例的描述,我们会对zookeeper应用场景会有深入的了解. 远程调 ...

  9. 如何利用 Visual Studio 自带工具提高开发效率

    Visual Stuido 是一款强大的Windows 平台集成开发工具,你是否好好地利用了它呢? 显示行号 有些时候(比如错误定位)的时候,显示行号将有利于我们进行快速定位. 如何显示 1. 工具 ...

  10. ABP(现代ASP.NET样板开发框架)系列之21、ABP展现层——Javascript函数库

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之21.ABP展现层——Javascript函数库 ABP是“ASP.NET Boilerplate Project ...