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?

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

| improve this answer | |
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

| improve this answer | |
  • 1
    I ran into the same issue. Thank dog for Xdebug and Mage/Core/Controller/Varien/Router/Standard.php – siliconrockstar Oct 10 '16 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.....

| improve this answer | |
  • 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 Nov 5 '14 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.