CharlesRock
CharlesRock

Reputation: 25

How do I add a new page to the customer account dashboard?

I have edited the customer.xml file to add a new link to the dashboard page. I added the following line

<action method="addLink" translate="label" module="customer"><name>newpage</name><path>customer/newpage/</path><label>My New Page</label></action>

I've also added the following block to customer.xml

<customer_newpage_index translate="label">
    <label>Customer My newpage</label>
    <!-- Mage_Customer -->
    <update handle="newpage"/>
    <reference name="my.account.wrapper">
        <block type="customer/newpage" name="newpage" before="-" template="customer/newpage.phtml"/>
    </reference>
</customer_newpage_index>

And added a template file at template/customer/newpage.phtml

The link displays, but I get a 404 page when I view /customer/newpage/

What am I missing here?

Thanks

Upvotes: 2

Views: 5755

Answers (1)

Max
Max

Reputation: 8836

You need to add a controller called NewpageController.php and in it have an action called indexAction. It is probably not a good idea to add this controller inside of the Customer module, because that is in core, and we never touch core. Instead, what you probably want to do is create your own module and put the controller inside of that. It can still be added as one of the links to the sidebar like you have done, but from the outside so that when you upgrade Magento you won't lose your controller.

Upvotes: 2

Related Questions