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

  • Is it not available at yoursite.com/helloworld/index/index ? – philwinkle Apr 25 '16 at 22:01
  • @philwinkle nope, it gives 404 page. – Nofel Apr 25 '16 at 22:03
  • @Nofel try yoursite.com/helloworld your example works for me considering there are no XML errors. – dchayka Apr 26 '16 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. – Nofel Apr 26 '16 at 4:27
  • Please try with domain.com/index.php/ammardotcome/helloworld your code have no issue. – Jaydip Kansagra Apr 26 '16 at 5:58
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
    ahhh, one of those problems :) mark your answer as the correct one. – dchayka Apr 26 '16 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.

  • No there is no spaces. – Nofel Apr 26 '16 at 4:28
  • @Nofel update your question then - it's misleading – Robbie Averill Apr 26 '16 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. – Nofel Apr 26 '16 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>
  • 2
    Tested this solution on 1.9.2.1 and still works without version defined. I was expecting it to fail :/ Interesting find. – dchayka Apr 26 '16 at 3:19

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.