Monday, 22 April 2013

Add Custom link in my account page Magento

Add Additionla link in Customer Page

1. app/design/frontend/default/theam/layout/customer.xml

2. Add below code in    <customer_account translate="label"> handle left part

<action method="addLink" translate="label" module="customer"><name>test</name><path>customer/test/</path><label>My Test</label></action>

3. add below code in xml file

<customer_test_index translate="label">
    <label>Customer My Test</label>
     <update handle="customer_account"/>
</customer_myships_index>

4. craete controller and block file in below location

app/code/core/mage/customer/block/test.php

add code in block file
class Mage_Customer_Block_Test extends Mage_Core_Block_Template
{
    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('customer/test.phtml');
       
    }
}
app/code/core/mage/customer/controllers/TestControler.php

add code in testcontroller
class Mage_Customer_TestController extends Mage_Core_Controller_Front_Action
{
  
    public function indexAction()
    {
        $this->loadLayout();
        $this->getLayout()->getBlock('content')->append(
            $this->getLayout()->createBlock('customer/test')
        );    
        $this->renderLayout();
       
       
          
      
    }
   
5. create file test.phtml in app/design/frontent/theme/customer/test.phtml

add code in file
<div class="page-title">
    <h1><?php echo $this->__('My Ships'); ?></h1>   
   
</div>


Now login from frontend and you show the test link add in your account page

2 comments:

  1. magento expert developers are the most experienced developers in their respective fields.

    ReplyDelete
  2. This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
    magento development company in bangalore 

    ReplyDelete