【发布时间】:2016-02-15 00:58:11
【问题描述】:
我已经在我的模块中设置了一个控制器来为我的安装添加一个订单导出选项卡:
在 config.xml 中:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<orderexport>abc_Orderexport_index2</orderexport>
</modules>
</args>
</adminhtml>
</routers>
<layout>
<updates>
<orderexport>
<file>orderexport.xml</file>
</orderexport>
</updates>
</layout>
</admin>
在 adminhtml.xml 中:
<?xml version="1.0"?>
<config>
<menu>
<sales>
<children>
<orderexport>
<title>Order Export</title>
<sort_order>20</sort_order>
<action>adminhtml/index2</action>
</orderexport>
</children>
</sales>
</menu>
<acl>
<resources>
<admin>
<children>
<sales>
<children>
<orderexport>
<title>Order Export</title>
<sort_order>20</sort_order>
</orderexport>
</children>
</sales>
</children>
</admin>
</resources>
</acl>
</config>
在控制器/Adminhtml/Index2Controller.php 文件中
class abc_Orderexport_Adminhtml_Index2Controller extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
但是,完成所有这些后,每当我单击“订单导出”按钮时,它都会将我重定向到 404 页面。这意味着 Magento 找不到控制器,但不知道为什么。
当我将控制器从 index2 重命名为 index(Index2Controller.php 到 IndexController.php)时,我没有被重定向到 404 页面,但是管理面板的仪表板只是重新加载。
我真的不知道我的错误在哪里,我很高兴有任何指向正确方向的提示。
【问题讨论】:
标签: magento controller adminhtml