0

Modifying an existing, functioning module, so assume the prerequisite setup code is fine. Adding to /app/code/local/Company/MyModule/etc/config.xml within <frontend/>:

        <routers>
            <mymodule>
                <use>standard</use>
                <args>
                    <module>Company_MyModule</module>
                    <frontName>mymodule</frontName>
                </args>
            </mymodule>
       </routers>

Created /app/code/local/Company/MyModule/controllers/IndexControlller.php:

<?php
    class Company_MyModule_IndexController extends Mage_Core_Controller_Front_Action {
        public function IndexAction() {
            die('hello, world');
        }
    }

Going to the expected address (www.company.com/mymodule) returns a 404 response.

  • Did you clear cache? – Renon Stewart Oct 6 '14 at 18:01
  • Caching is disabled. I deleted it anyway. No change. – Dissident Rage Oct 6 '14 at 18:02
  • Can you add your entire config.xml – Renon Stewart Oct 6 '14 at 18:03
  • Is there something in particular you're looking for in it? There's no duplicate <frontend/> and the rest of the module works as expected. I just can't get the controller to work. In fact, I've never been able to get any controllers to work that I've made. – Dissident Rage Oct 6 '14 at 18:06
  • Try create a module with only 'Need Frontend Page' at silksoftware.com/magento-module-creator/#.VDLbDNPF-QM ... if this don't then you may have a module that preventing it – Renon Stewart Oct 6 '14 at 18:11
1

The problem was that the store code was not present in the URL. It was also set to "Yes" under System > Configuration > Web > Url Options > Add Store Code to Urls.

0

Enable your Module app\etc\modules\Company_MyModule.xml

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

app\code\local\Company\MyModule\etc\config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Company_MyModule>
      <version>0.1.0</version>
    </Company_MyModule>
  </modules>
  <frontend>
    <routers>
      <mymodule>
        <use>standard</use>
          <args>
            <module>Company_MyModule</module>
            <frontName>mymodule</frontName>
          </args>
      </mymodule>
    </routers>
        <layout>
          <updates>
            <mymodule>
              <file>mymodule.xml</file>
            </mymodule>
          </updates>
        </layout>
  </frontend>
  <global>
    <helpers>
      <mymodule>
        <class>Company_MyModule_Helper</class>
      </mymodule>
    </helpers>
    <blocks>
      <mymodule>
        <class>Company_MyModule_Block</class>
      </mymodule>
    </blocks>
  </global>
</config> 

app\code\local\Company\MyModule\controllers\IndexController.php

<?php
class Company_MyModule_IndexController extends Mage_Core_Controller_Front_Action{
    public function IndexAction() {      
      $this->loadLayout();    
      $this->renderLayout();      
    }
}

app\code\local\Company\MyModule\Helper\Data.php

<?php
class Company_MyModule_Helper_Data extends Mage_Core_Helper_Abstract
{
}

You can define layout Block in app\design\frontend\base\default\layout\mymodule.xml

<?xml version="1.0"?>   
<layout version="0.1.0">   
  <mymodule_index_index>   
    <reference name="root">   
      <action method="setTemplate"><template>page/1column.phtml</template></action>   
    </reference>   
    <reference name="content">   

    </reference>   
  </mymodule_index_index>   
</layout>   
  • The module already has prerequisite information (i.e. Company_MyModule.xml), as well as configured Models and a Helper at Helper\Data.php. The controller does not need to perform any layout duties whatsoever; its only purpose will be to serve text data as a response to an AJAX script. – Dissident Rage Oct 6 '14 at 18:19
  • Are you make sure your permission to Module files – Dharmen Gunawat Oct 6 '14 at 18:28
  • Yes, it's a local install in Windows. – Dissident Rage Oct 6 '14 at 22:02
0

Checkout these things.

  1. I can see an error in your index action. It should be index, instead of Index. ie

    public function indexAction() 
    {
        die ('hello, world');
    }
    
  2. Make sure your module is active. For this go to

    System  >  Configuration  >  Advanced
    

and check whether module is available over there.

  1. Check all of your file permissions. Make it has 777 permission

  2. Try out www.domain.com/index.php/mydomain

Edit

  1. I can see another error in your controller file. The class name should be Company_MyModule_IndexController instead of Company_MyModule_indexController.

  2. If none of the above method exists, then checkout log files. You may see some errors there. If exists, please put add it with your question

  • 1. I thought so. The generated code from a comments suggested it be capitalized, so I tried that. Will revert to indexAction. 2. It's active. 3. Testing on a local install on Windows. I totally have permission. 4. Tried that method and several others. – Dissident Rage Oct 6 '14 at 19:13
  • removed cache ? – Rajeev K Tomy Oct 7 '14 at 3:51
  • I have updated answer. Please go through it – Rajeev K Tomy Oct 7 '14 at 3:57
  • Caching is disabled. Fixed capitalization; no dice. There are also no errors being logged. – Dissident Rage Oct 7 '14 at 4:02
0
  1. Check "allow symlink" in database
  2. Check if you have store in your url
  3. Check module config and folder - local or community
  4. Check spelling, folder structure, folder and file names, camelcase and underscores
  5. Check if folder/files are accessible (exists and has right permissions) for webserver

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.