2

I am learning to make sense of magento and i am stuck.I have different stores and i am creating a controller but it seem it is not working and giving 404. Following is my code config.xml under /app/code/local/Ammardotcom/Helloworld/etc

    <?xml version="1.0" encoding="UTF-8"?>
<config>
    <frontend>
        <routers>
            <helloworld>
                    <use>standard</use>
                <args>
                    <module>Ammardotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
</config>

and under app/etc/modules/ Ammardotcom_Helloworld.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Ammardotcome_Helloworld>
                <active>true</active>
                <codePool>local</codePool>
        </Ammardotcome_Helloworld>
    </modules>
</config>

while my file is called IndexController.php and it has following code under /app/code/local/Ammardotcom/Helloworld/controllers/

class Ammardotcome_Helloworld_IndexController
extends Mage_Core_Controller_Front_Action{
        public function indexAction() {
        echo 'Hello Index!';
    }
}

The module shows in backend but isn't loading, i am following @Alan tut

5
  • Is it not available at yoursite.com/helloworld/index/index ?
    – philwinkle
    Commented Apr 25, 2016 at 22:01
  • @philwinkle nope, it gives 404 page.
    – localhost
    Commented Apr 25, 2016 at 22:03
  • @Nofel try yoursite.com/helloworld your example works for me considering there are no XML errors.
    – dchayka
    Commented Apr 26, 2016 at 3:21
  • @dchayka yes i tried that too but nothing, can it be because of multiple store setup? I don't think it should.
    – localhost
    Commented Apr 26, 2016 at 4:27
  • Please try with domain.com/index.php/ammardotcome/helloworld your code have no issue. Commented Apr 26, 2016 at 5:58

3 Answers 3

3

After many hours of hair pulling, i found out the reason, i misspelled my node in comparison to my folder namespace/module_name where namespace was Ammardotcome and xml node was Ammardotcom

1
  • 1
    ahhh, one of those problems :) mark your answer as the correct one.
    – dchayka
    Commented Apr 26, 2016 at 15:12
1

You need to remove blank spaces from start of your config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <frontend>
        <routers>
            <helloworld>
                    <use>standard</use>
                <args>
                    <module>Ammardotcom_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
</config>

If you add blank spaces at the start of your xml file, it may not load.

3
  • No there is no spaces.
    – localhost
    Commented Apr 26, 2016 at 4:28
  • @Nofel update your question then - it's misleading
    – scrowler
    Commented Apr 26, 2016 at 4:57
  • @RobbieAverill no, it is the same as i had problem with. Not misleading, the solution provided by me is a update to the question resulting in the question's answer.
    – localhost
    Commented Apr 26, 2016 at 5:00
-1

You have not defined module version in config.xml

<config>
    <modules>
        <Ammardotcome_Helloworld>
            <version>0.1.0</version>
        </Ammardotcome_Helloworld>
    </modules>
    .....
</config>
1
  • 2
    Tested this solution on 1.9.2.1 and still works without version defined. I was expecting it to fail :/ Interesting find.
    – dchayka
    Commented Apr 26, 2016 at 3:19

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.