0

I have created a custom module probably 20 times and it is showing the same 404 error.

I have searched for an issue and eventually found nothing. isn't it because I am using ubuntu.

Please correct me if I am wrong.

This is my app/etc/Kuldeep_HelloWorld.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <Kuldeep_HelloWorld>
            <active>true</active>
            <codePool>local</codePool>
        </Kuldeep_HelloWorld>
    </modules>
</config>

This is app/code/local/Kuldeep/HelloWorld/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Kuldeep_HelloWorld>
      <version>0.1.0</version>
    </Kuldeep_HelloWorld>
  </modules>
  <frontend>
    <routers>
      <helloworld>
        <use>standard</use>
        <args>
          <module/>Kuldeep_HelloWorld</module>
          <frontName>hey</frontName>
        </args>
      </helloworld>
    </routers>
  </frontend>
<admin>
  <routers>
    <helloworld>
     <use>admin</use>
     <args>
      <module>Kuldeep_HelloWorld</module>
      <frontName>admin_helloworld</frontName>
     </args>
    </helloworld>
  </routers>
</admin>
<global>
  <helpers>
    <helloworld>
      <class>Kuldeep_HelloWorld_Helper</class>
    </helloworld>
  </helpers>
</global>
<adminhtml>
 <menu>
   <helloworld module="helloworld">
     <title>HelloWorld</title>
     <sort_order>100</sort_order>
    <children>
      <helloworld module="helloworld">
        <title>Hello World</title>
        <sort_order>0</sort_order>
        <action>admin_helloworld/adminhtml_index</action>
      </helloworld>
    </children>
   </helloworld>
 </menu>
</adminhtml>
</config>

This is controller file: app/code/local/Kuldeep/HelloWorld/controllers/IndexController.php

<?php
class Kuldeep_HelloWorld_IndexController extends Mage_Core_Controller_Front_Action{

   /**
   * Index action
   *
   * @access public

   * @return void
   */
   public function indexAction() {

      echo "it works!";

   }

   public function doneintagainAction() {

      echo "done it again....!!!!";
      }
}
?>
2
  • did you give full permission to app/etc folder? Commented Aug 30, 2017 at 15:04
  • What URL are you using to try and view the module? Your frontname is set to 'hey', so your url would be like your-magento.com/hey/index/ Commented Aug 30, 2017 at 15:24

2 Answers 2

2

You have a syntax error in your etc/config.xml:

<module/>Kuldeep_HelloWorld</module>

If you notice in the first module tag, you have a slash. Change it to this:

<module>Kuldeep_HelloWorld</module>

Also, you never noted which URLs you are trying. Could you post those?

2
0

app/etc/Kuldeep_Helloworld.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Kuldeep_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
        </Kuldeep_Helloworld>
    </modules>
</config>

app/code/local/Kuldeep/Helloworld/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Kuldeep_Helloworld>
            <version>0.1.0</version>
        </Kuldeep_Helloworld>
    </modules>
    <global>
        <helpers>
            <helloworld>
                <class>Kuldeep_Helloworld_Helper</class>
            </helloworld>
        </helpers>
    </global>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Kuldeep_Helloworld</module>
                    <frontName>hey</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
    <admin>
        <routers>
            <helloworld>
                <use>admin</use>
                <args>
                    <module>Kuldeep_Helloworld</module>
                    <frontName>admin_helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </admin>
    <adminhtml>
    <menu>
        <helloworld module="helloworld" translate="title">
            <title>HelloWorld</title>
            <sort_order>100</sort_order>
            <children>
                <helloworld module="helloworld" translate="title">
                    <title>Hello World</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/menu/index</action> //adminhtml controller
                </helloworld>
            </children>
        </helloworld>
    </menu>
    </adminhtml>
</config>

app/code/local/Kuldeep/Helloworld/controllers/IndexController.php

<?php
class Kuldeep_Helloworld_IndexController extends Mage_Core_Controller_Front_Action
{

   public function indexAction()
   {
       echo "it works!";
   }

   public function doneintagainAction()
   {
       echo "done it again....!!!!";
   }
}

/*you dont need to close a php tag-> "?>" */

NB: you need an adminhtml controller for your menu, the first one that you created was for frontend.

app/code/local/Kuldeep/Helloworld/controllers/Adminhtml/MenuController.php

<?php

class Kuldeep_Helloworld_Adminhtml_MenuController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('menu/menu')
            ->_title($this->__('Submenu1'));
        $this->renderLayout();
    }
}

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.