本文转自: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. “.Net 社区虚拟大会”(dotnetConf) 2016 Day 1 Keynote: Scott Hunter

    “.Net 社区虚拟大会”(dotnetConf) 2016 今天凌晨在Channel9 上召开,在Scott Hunter的30分钟的 Keynote上没有特别的亮点,所讲内容都是 微软“.Net社 ...

  2. CSS十问——好奇心+刨根问底=CSSer

    最近有时间,想把酝酿的几篇博客都写出来,今天前端小学生带着10个问题,跟大家分享一下学习CSS的一些体会,我觉得想学好CSS,必须保持一颗好奇心和刨根问底的劲头,而不是复制粘贴,得过且过.本人能力有限 ...

  3. javascript之Object.defineProperty的奥妙

    直切主题 今天遇到一个这样的功能: 写一个函数,该函数传递两个参数,第一个参数为返回对象的总数据量,第二个参数为初始化对象的数据.如: var o = obj (4, {name: 'xu', age ...

  4. DataTable 转换成 Json的3种方法

    在web开发中,我们可能会有这样的需求,为了便于前台的JS的处理,我们需要将查询出的数据源格式比如:List<T>.DataTable转换为Json格式.特别在使用Extjs框架的时候,A ...

  5. Kooboo CMS技术文档之三:切换数据存储方式

    切换数据存储方式包括以下几种: 将文本内容存储在SqlServer.MySQL.MongoDB等数据库中 将站点配置信息存储在数据库中 将后台用户信息存储在数据库中 将会员信息存储在数据库中 将图片. ...

  6. 创建ABPboilerplate模版项目

    本文是根据角落的白板报的<通过ABPboilerplate模版创建项目>一文的学习总结,感谢原文作者角落的白板报. 1 准备 开发环境: Visual Studio 2015 update ...

  7. T-SQL字符串相加之后被截断的那点事

    本文出处:http://www.cnblogs.com/wy123/p/6217772.html 字符串自身相加, 虽然赋值给了varchar(max)类型的变量,在某些特殊情况下仍然会被“截断”,这 ...

  8. 从零自学Hadoop(22):HBase协处理器

    阅读目录 序 介绍 Observer操作 示例下载 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,Sour ...

  9. TCP三次握手图解

  10. 用ffmpeg快速剪切和合并视频

    如果直接找视频剪切和合并视频的软件,通常出来的都是大的视频编辑软件或者是有图形界面的剪切软件,大型一点的功能太多安装麻烦,小型一点的功能可能不齐全. 只是简单的剪切或者一下合并一下,还是ffmpeg这 ...