0

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?

asked Nov 5, 2014 at 13:47

3 Answers 3

2

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/...

answered Nov 5, 2014 at 20:40
2

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

answered May 20, 2016 at 9:02
1
  • 1
    I ran into the same issue. Thank dog for Xdebug and Mage/Core/Controller/Varien/Router/Standard.php Commented Oct 10, 2016 at 21:21
0

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

https://example.com/admin/customShipping/check.....

answered Nov 5, 2014 at 13:56
1
  • 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. Commented Nov 5, 2014 at 14:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.