本文转自: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. python3  threading初体验

    python3中thread模块已被废弃,不能在使用thread模块,为了兼容性,python3将thread命名为_thread.python3中我们可以使用threading进行代替. threa ...

  2. c#与java的区别

    经常有人问这种问题,用了些时间java之后,发现这俩玩意除了一小部分壳子长的还有能稍微凑合上,基本上没什么相似之处,可以说也就是马甲层面上的相似吧,还是比较短的马甲... 一般C#多用于业务系统的开发 ...

  3. DB1:数据库的创建和文件的修改

    在SQL Server中,使用Create Database创建数据库,使用Alter Database命令,能够修改数据库的数据文件和日志文件. 一,创建数据库 1,在创建数据库时,最佳实践是: 创 ...

  4. 使用etree.HTML的编码问题

    title: 使用etree.HTML的编码问题 date: 2015-10-07 17:56:47 categories: [Python] tags: [Python, lxml, Xpath] ...

  5. Android数据加密之Base64编码算法

    前言: 前面学习总结了平时开发中遇见的各种数据加密方式,最终都会对加密后的二进制数据进行Base64编码,起到一种二次加密的效果,其实呢Base64从严格意义上来说的话不是一种加密算法,而是一种编码算 ...

  6. Mysql存储引擎比较

    Mysql作为一个开源的免费数据库,在平时项目当中会经常使用到,而在项目当中我们的着重点一般在设计使用数据库上而非mysql本身上,所以在提到mysql的存储引擎时,一般都不曾知道,这里经过网上相关文 ...

  7. jq选择器基础

    Jquery $代表选择器 使用jq必须要导入jq文件 <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js&qu ...

  8. Axure 8.0.0.3312可用注册码

    用户名:aaa 注册码:2GQrt5XHYY7SBK/4b22Gm4Dh8alaR0/0k3gEN5h7FkVPIn8oG3uphlOeytIajxGU 用户名:axureuser 序列号:8wFfI ...

  9. [转载]一个标准java程序员的进阶过程

    第一阶段:Java程序员 技术名称 内                 容 说明 Java语法基础 基本语法.数组.类.继承.多态.抽象类.接口.object对象.常用类(Math\Arrarys\S ...

  10. jquery实现下拉框多选

    一.说明 本文是利用EasyUI实现下拉框多选功能,在ComboxTree其原有的基础上对样式进行了改进,样式表已上传demo,代码如下 二.代码 <!DOCTYPE html PUBLIC & ...