2

I am following the book: Getting Started with Magento Extension Development. And I'm unable to make my extension echoing "Hello World".

I believed there are 3 area I need to take care:

  1. active the module from app/etc/modules/Froggyline_HappyHour.xml.

  2. File: app/code/community/Froggyline/HappyHour/etc/config.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <config>
        <modules>
            <Froggyline_HappyHour>
                <version>0.0.0</version>
            </Froggyline_HappyHour>
        </modules>
        <frontend>
            <routers>
                <froggyline_happyhour>
                    <use>standard</use>
                    <args>
                        <module>Froggyline_Happyhour</module>
                        <frontName>happyhour</frontName>
                    </args>
                </froggyline_happyhour>
            </routers>
        </frontend>
    </config>
    
  3. FILE: app/code/community/Froggyline/HappyHour/controller/GreetingController.php

    <?php
    class Froggyline_HappyHour_GreetingController extends Mage_Core_Controller_Front_Action
    {
        public function helloWorldAction()
        {
            echo 'Hello World';
        }
    }
    ?>
    

I am visiting the following URL: http://localhost/happyhour/greeting/helloWorld and receive Http 404.

Which step did I miss, so that the page will display "Hello World"?

3

3 Answers 3

5

this is test and working

app/etc/modules/Froggyline_HappyHour.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Froggyline_HappyHour>
      <active>true</active>
      <codePool>community</codePool>
      <version>0.0.0</version>
    </Froggyline_HappyHour>
  </modules>
</config>

app/code/community/Froggyline/HappyHour/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Froggyline_HappyHour>
      <version>0.0.0</version>
    </Froggyline_HappyHour>
  </modules>
  <frontend>
    <routers>
      <happyhour>
        <use>standard</use>
          <args>
            <module>Froggyline_HappyHour</module>
            <frontName>happyhour</frontName>
          </args>
      </happyhour>
    </routers>

  </frontend>

</config> 

missing the controllers folder (s) app/code/community/Froggyline/HappyHour/controllers/GreetingController.php

<?php
class Froggyline_HappyHour_GreetingController extends Mage_Core_Controller_Front_Action{
    public function HelloWorldAction() {

     echo "hello world"; exit;

    }
}
4
  • 1
    Oh, damn.... This book just waste my whole day debugging. It is written controller which supposed to be controllers. You just saved my life.... Thank you.. :)
    – Yeo
    Commented May 20, 2015 at 15:56
  • I'm referring to 2 books, I just mixed up with another book called "Magento Extension Developers Guide Guide v1.0". The typo is actually in this official book instead and not the book I mentioned in my original question.
    – Yeo
    Commented May 20, 2015 at 16:08
  • controller is used but for something else Commented May 20, 2015 at 16:09
  • Oh, I didn't know that. anyway, thanks for the information :)
    – Yeo
    Commented May 20, 2015 at 16:11
0

Make sure the version number in the config.xml matches the app/etc/modules/Froggyline_HappyHour.xml

Also, I've never seen a version 0.0.0. Try making it 0.1.0

1
  • This didn't work.
    – Yeo
    Commented May 20, 2015 at 15:51
-1

Glad it worked at last. Don't forget to review all the file names as well...

Everything on the book is alright except in this file:

app/code/community/Foggyline/HappyHour/etc/ config.xml

Where you have to replace

<routers>
  <foggyline_happyhour>
  ...
  <foggyline_happyhour>
<routers>

by

<routers>
  <happyhour>
  ...
  <happyhour>
<routers>

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.