[转]NopCommerce How to add a menu item into the administration area from a plugin
本文转自:http://docs.nopcommerce.com/display/nc/How+to+code+my+own+shipping+rate+computation+method
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的更多相关文章
- Editor Scripting学习笔记之Menu Item
主要用到: MenuItem属性 MenuCommand参数 可能用到: EditorApplication类 Selection类 GameObjectUtility类 FileUtil类 Undo ...
- -25299 reason: 'Couldn't add the Keychain Item.'
今天在用苹果官方demo 提供的KeychainItemWrapper类时遇到-25299 reason: 'Couldn't add the Keychain Item.'错误,再4s上可以正常运 ...
- Toolbar 和 CollapsingToolbarLayout一起使用时menu item无点击反应解决办法
昨天一直在琢磨为什么Toolbar和CollapsingToolbarLayout一起使用时menu item无点击放应的原因,后来在stackoverflow上一条回答,说可能是Toolbar的背景 ...
- create-react-app 搭建的项目中,让 antd 通过侧边栏导航 Menu 的 Menu.Item 控制 Content 部分的变化
第一种:BrowserRouter把Menu和Route组给一起包起来 <Router></Router> 标签要把Menu和Route组给一起包起来 修改src/index. ...
- could not execute menu item系统找不到指定的文件
Wamp3.0.6 64bit,系统任务栏图标,左键,Apache菜单,httpd.conf,报错“could not execute menu item.....系统找不到指定的文件” 根据网上的搜 ...
- 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 ...
- iOS开发—— Couldn't add the Keychain Item
报错:*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn ...
- cocos2d-x 3.2,Label,Action,Listener,Menu Item等简单用法
转载自:http://blog.csdn.net/pleasecallmewhy/article/details/34931021 创建菜单(Menu Item) // 创建菜单 auto menuI ...
- sampleviewer add menu item error 'assert'
可以跟踪到 mfc提供的源代码内部,(注:如果打开了mfc源代码,设置了断点,但是跟不进去,那就需要更新PDB文件,具体网上搜)打开 wincore.cpp文件(D:\Program Files\Mi ...
随机推荐
- iPhone Anywehre虚拟定位提示“后台服务未启动,请重新安装应用后使用”的解决方法
问题描述: iPhone越狱了,之后在Cydia中安装Anywhere虚拟定位,但是打开app提示:后台服务未启动,请重新安装应用后使用. 程序无法正常使用... 解决方法: 打开Cydia-已安装, ...
- hadoop 2.7.3本地环境运行官方wordcount-基于HDFS
接上篇<hadoop 2.7.3本地环境运行官方wordcount>.继续在本地模式下测试,本次使用hdfs. 2 本地模式使用fs计数wodcount 上面是直接使用的是linux的文件 ...
- 【翻译】MongoDB指南/CRUD操作(二)
[原文地址]https://docs.mongodb.com/manual/ MongoDB CRUD操作(二) 主要内容: 更新文档,删除文档,批量写操作,SQL与MongoDB映射图,读隔离(读关 ...
- lua执行字节码的过程介绍
前面一篇文章中介绍了lua给下面代码生成最终的字节码的整个过程,这次我们来看看lua vm执行这些字节码的过程. foo = "bar" local a, b = "a& ...
- Python 正则表达式入门(中级篇)
Python 正则表达式入门(中级篇) 初级篇链接:http://www.cnblogs.com/chuxiuhong/p/5885073.html 上一篇我们说在这一篇里,我们会介绍子表达式,向前向 ...
- 真假4K电视验证:一张图足矣
国庆期间笔者逛了一下电视卖场,考虑到国内电视台以及宽带的情况,1080P至少还能用十年,所以只想要个2k电视就够了.然而事与愿违,卖场中八成的都是4k电视,清一色的4k电视让人眼花缭乱.难道4k面板技 ...
- 高德地图api实现地址和经纬度的转换(python)
利用高德地图web服务api实现地理/逆地址编码 api使用具体方法请查看官方文档 文档网址:http://lbs.amap.com/api/webservice/guide/api/georegeo ...
- NSURLSession详解
导语 现在NSURLConnection在开发中会使用的越来越少,iOS9已经将NSURLConnection废弃,现在最低版本一般适配iOS7,所以也可以使用. NSURLConnection相对于 ...
- TFS2013 设置签出独占锁
转载自: http://www.cnblogs.com/zhang888/p/4280251.html
- 多本地代码工作点更新到2个远端GIT仓库
摘要:本文介绍了笔者多个本地工作节点(地方)的多台电脑(PC/笔记本电脑)同步源码到2个远端的GIT(一个GITHUB国外强制公开,一个oschina国内可不公开). 作者:太初 转载说明:请指明原作 ...