0

I am creating a custom extension with Magento 1.9.0.1 but got stuck in admin controller as my admin controller throws 404 page not found error. Any help would be appreciated. Below is my code : config.xml

app/code/local/Codifiedweb/SurveySource/etc/config.xml

<?xml version="1.0"?>

<config>
    <modules>
        <Codifiedweb_SurveySource>
            <version>1.0.0</version>
        </Codifiedweb_SurveySource>
    </modules>
    <admin>
    <routers>
      <surveysource>
        <use>standard</use>
        <args>
          <modules>
              <codifiedweb_surveysource before="Mage_Adminhtml">Codifiedweb_SurveySource_Adminhtml</codifiedweb_surveysource>
          </modules>
        </args>
      </surveysource>
    </routers>
  </admin>
    <global>
        <blocks>
            <surveysource>
                <class>Codifiedweb_SurveySource_Block</class>
            </surveysource>
            <adminhtml>
                <rewrite>   <sales_order_grid>Codifiedweb_SurveySource_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
                </rewrite> 
            </adminhtml>
        </blocks>
         <helpers>
      <surveysource>
        <class>Codifiedweb_SurveySource_Helper</class>
      </surveysource>
    </helpers>
        <models>
            <surveysource>
                <class>Codifiedweb_SurveySource_Model</class>
            </surveysource>
        </models>
    </global>
</config>

adminhtml.xml

app/code/local/Codifiedweb/SurveySource/etc/adminhtml.xml

I am creating submenu under CMS

<?xml version="1.0"?>
    <config>
        <menu>
            <cms>
                <children>
                    <surveysourcebackend module="surveysource">
                            <title>Survey Statics</title>
                            <sort_order>100</sort_order>
                            <action>adminhtml/surveysource</action>
                     </surveysourcebackend>
                </children>
            </cms>
        </menu>
    </config>

Controller

SurveySourceController.php

app/code/local/Codifiedweb/SurveySource/controllers/Adminhtml

<?php
class CodifiedWeb_SurveySource_Adminhtml_SurveySourceController extends Mage_Adminhtml_Controller_Action
{
  public function indexAction()
  {

    // $this->loadLayout();
     //$this->_title($this->__("Survey Statics"));
     //$this->renderLayout();
     echo "Iam  in admin controller";
     exit;
  }
}

Where I am doing mistake?

Thanks

2 Answers 2

1

1) Change SurveySource to Surveysource module name, controller name .. and update it everywhere

2) The class of your controller, you put CodifiedWeb instead of Codifiedweb

<?php
    class Codifiedweb_Surveysource_Adminhtml_SurveysourceController extends Mage_Adminhtml_Controller_Action
    {
      public function indexAction()
      {

        // $this->loadLayout();
         //$this->_title($this->__("Survey Statics"));
         //$this->renderLayout();
         echo "Iam  in admin controller";
         exit;
      }
    }
3
  • I tried as you said but still getting the same 404 error Commented May 14, 2017 at 17:23
  • I have a quick look to your code you miss other things too, try to clean a cache then logout and login.
    – PЯINCƎ
    Commented May 14, 2017 at 23:21
  • Yes I cleaned the cache and logout and login too.. Would you mind telling me what other things i am missing. Commented May 15, 2017 at 10:56
0

You need add acl in file adminhtml.xml after </config>

 <acl>
    <resources>
        <admin>
            <children>
               <cms>
                   <children>                
                       <surveysourcebackend translate="title" module="codifiedweb_surveysource">
                    <title>Survey Statics</title>
                    <sort_order>100</sort_order>
                       </surveysourcebackend>
                   </children>
                </cms>
            </children>
        </admin>
    </resources>
</acl>

Please see example http://www.bubblecode.net/en/2012/02/08/magento-create-your-own-admin-controller-in-a-new-tab/

http://alanstorm.com/magento_admin_hello_world_revisited/

1
  • I guess you mean to say before</config> because when i try to add that after </config> my menu disappears. But still showing 404 error Commented May 14, 2017 at 17:25

Your Answer

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

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