I have created and enabled a custom module in my magento store called 'Earnings' to allocate customers loyalty points. I declare the phtml file to use (template/earnings/earnings.phtml) in my earnings.xml as below


<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="content">
            <block type="earnings/earnings" name="earnings" />

I want the page that uses this template file to be linked from the customer account navigation when they log in (same place as my addresses/my billing agreements/my orders etc). In my local.xml i use addLink as below:


    <reference name="sidebar">
        <action method="unsetChild"><name>reorder</name></action>
        <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
            <action method="addLink" translate="label" module="earnings"><name>earnings</name><path>earnings/earnings/</path><label>Earnings</label></action>
        <remove name="tags_popular"/>

Now when i log into the customer account the link is there,it goes to the url http://www.mysite.com/earnings/earnings but this gives my a 404 page not found

I am very new to magento and this is my first go at creating custom modules. Am i missing something or doing something in the wrong way?


This is the path reference that you are provided in a layout file


This will set your link to this path http://www.website.com/earnings/earnings. When Magento looks for this path, it cannot find a valid controller definition. That is why it throws 404 error. So set your path to


will solve your issue. Now the link looks like http://www.website.com/earnings/index/. You have defined your block for this specific URL. Note you have used earning_index_index handle in your layout file. This handle will be processed by Magento only when http://www.website.com/earnings/index/ URL get requested.

Note: In order to work this URL perfectly, you should have an IndexController.php is defined for your module and this file should hold this method.

public function indexAction() {


If this method and this file are not defined for your module, Magento will throw 404 error again.

| improve this answer | |

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.