I Created a custom module. My requirement is to add new link after all links in Customer My Account. When click on that new link a new page should be shown.
My Code is
Step 1. Created new file in app/etc/modules
named Badge_page.xml
<?xml version="1.0"?>
<config>
<modules>
<Badge_page>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</Badge_page>
</modules>
</config>
Step 2. Created new file in app/code/local/Badge/Page/etc
named config.xml
<?xml version="1.0"?>
<config>
<global>
<modules>
<Badge_Page>
<version>0.1.0</version>
</Badge_Page>
</modules>
<blocks>
<achievements>
<achievements>Badge_Page_Block_Achievements</achievements>
</achievements>
</blocks>
</global>
<frontend>
<routers>
<achievements>
<use>standard</use>
<args>
<frontName>achievements</frontName>
<module>Badge_Page</module>
</args>
</achievements>
</routers>
<layout>
<updates>
<achievements>
<file>achievements.xml</file>
</achievements>
</updates>
</layout>
</frontend>
</config>
Step 3. Created Controller File app/code/local/Badge/Page/controllers
named IndexController.php
<?php
class Badge_Page_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('head')->setTitle($this->__('My Badges'));
$this->renderLayout();
}
}
Step 4. Created Block File app/code/local/Badge/Page/Block
named Achievements.php
<?php
class Badge_Page_Block_Achievements extends Mage_Core_Block_Template
{
public function _construct()
{
parent::_construct(); // TODO: Change the autogenerated stub
$this->setTemplate("page/badgepage.phtml");
}
}
Step 5. And then Updated my local.xml
file in app/design/frontend/Package/template/layout
<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account>
<reference name='customer_account_navigation'>
<action method="addLink" translate="label" module="customer">
<name>badgepage</name>
<path>achievements</path>
<label>My Badges</label></action>
</reference>
</customer_account>
</layout>
Step 6 Created achievements.xml
file under app/design/frontend/Package/template/layout
<?xml version="1.0"?>
<layout version="0.1.0">
<achievements_index_index translate="label">
<label>Badge Page</label>
<update handle="customer_account"/>
<reference name="root">
<action method="setTemplate"><template>page/badgepage.phtml</template></action>
</reference>
<reference name="content">
<block type="achievements/index" name="page_content_heading" template="page/badgepage.phtml"/>
</reference>
</achievements_index_index>
</layout>
Step 7 Created badgepage.phtml
under app/design/frontend/Package/template/badge/
<?php echo "My Custom Module Output;"?>
Here I can see the link in My Account Dashboard But when I Click on it I was getting 404 Error.. Where am I going. Please Suggest me the Solution.
Thanks.