I'm just trying to create a simple adminhtml controller.
#config.xml:
<?xml version="1.0"?>
<config>
<modules>
<AD_CustomShipping>
<version>0.1.0</version>
</AD_CustomShipping>
</modules>
<global>
<blocks>
<AD_CustomShipping>
<class>AD_CustomShipping_Block</class>
</AD_CustomShipping>
</blocks>
<helpers>
<AD_CustomShipping>
<class>AD_CustomShipping_Helper</class>
</AD_CustomShipping>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<AD_CustomShipping after="Mage_Adminhtml">AD_CustomShipping</AD_CustomShipping>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
This is the controller:
#app/code/local/AD/CustomShipping/controllers/CustomShippingController.php
/**
* Class AD_Customshipping_CustomShippingController
*/
class AD_CustomShipping_CustomShippingController extends Mage_Adminhtml_Controller_Action
{
/**
* Return some checking result
*
* @return void
*/
public function checkAction()
{
$result = 1;
Mage::app()->getResponse()->setBody( $result );
}
}
When I try to reach the URL https://example.com/adminpanel/customshipping/check/key/6df9ce54d9c315cbdf9484dc54dfcd678/ it shows me 404 Error.
What am doing wrong?
3 Answers 3
Okay, I solved the problem.
I have to have the CustomshippingController.php in the /app/code/local/AD/CustomShipping/controllers/ folder
And the correct URL is:
https://example.com/index.php/adminpanel/customshipping/check/...
It took me ages to figure out that
<args>
<modules>
<myrandomtag before="Mage_Adminhtml">
My_Module_Adminhtml
</myrandomtag>
</modules>
</args>
IS NOT SAME AS
<args>
<modules>
<myrandomtag before="Mage_Adminhtml">My_Module_Adminhtml</myrandomtag>
</modules>
</args>
So there should be no space or new line inside your random tag
-
1I ran into the same issue. Thank dog for Xdebug and Mage/Core/Controller/Varien/Router/Standard.phpsiliconrockstar– siliconrockstar2016年10月10日 21:21:52 +00:00Commented Oct 10, 2016 at 21:21
As you have using new new system
<AD_CustomShipping after="Mage_Adminhtml">AD_CustomShipping</AD_CustomShipping>
</modules>
create admin controller so.
CustomShippingController.php location app/code/local/AD/CustomShipping/controllers/ should be
app/code/local/AD/CustomShipping/controllers/Adminhtml/
and you can access this by
-
I created the Adminhtml folder and moved the controller file into there. And renamed the controller's class name. Still doesn't work.. Please note that I use the URL example.com/adminpanel... not example.com/admin..., because the admin panel URL prefix is changed in the system configuration.Serhii Matrunchyk– Serhii Matrunchyk2014年11月05日 14:23:47 +00:00Commented Nov 5, 2014 at 14:23