Create custom tab in magento customer myaccount section
Create custom tab in magento customer myaccount section:
Once customer logged into the magento website, the page should redirect to Myaccount section. Magento default have some tab’s like My Order, My Whishlist, etc..
But in some times, you may create your own module, and need to show that tab into myaccount section, what you want to ? follow the steps you will get your custom tab Step:1
app\design\frontend\jute\default\layout\mymodule.xml
<?xml version=”1.0″?>
<layout version=”0.1.0″>
<customer_account translate=”label”>
<reference name=”customer_account_navigation”> -> this may be addLink or customer_account_navigation (its depend on the requirment)
<action method=”addLink” translate=”label” module=”mymodule”><name>viewmymodule</name><path>mymodule/customer/view/</path><label>My Mymodule</label></action>
</reference>
</customer_account>
<mymodule_customer_view> –> controller path
<update handle=”customer_account”/> –> we are overriding so need this line
<reference name=”content”>
<block type=”mymodule/mymodule” name=”mymodule.view” template=”mymodule/customer/view.phtml”/>
</reference>
</mymodule_customer_view>
</layout>
Step: 2 Create view.phtml file in your module
Ex: app/design/frontend\jute\default\template\mymodule\customer\view.phtml
Here wrote your own code.
Step:3
Need to create one block file this(app/code/local/Jute/Mymodule/block/mymodule.php)
mymodule/mymodule
Step:4
Create controller file, call your block file
app\code\local\Jute\Mymodule\controllers\MyController.php
/**
* View Your Module
*/
public function viewAction()
{
$this->loadLayout();
$this->getLayout()->getBlock(‘head’)->setTitle($this->__(‘Mymodule’));
$this->renderLayout();
}