Add a new tab on customer panel in magento

We Are Professional

Add a new tab on customer panel in magento

In magento, normally 12 tabs show in MY ACCOUNT panel. In this post, I will show how to add a new tab(Auction) on customer panel in magento. This 12 tabs show from app\design\frontend\bonsaisuperstore\default\template\customer\account\navigation.phtml

1. At first open the navigation.phtml file and add a new anchor under li on your ul tag after end of foreach like below
[sourcecode language=”plain”]
<li class=”last <?php if($current_url == $auctionurl){echo “auctionli”;}?>”><a href=”<?php echo $auctionurl;?>”>Auction</a></li>
[/sourcecode]
where I assigned those variables by
[sourcecode language=”plain”]
$home_url = Mage::helper(‘core/url’)->getHomeUrl();
$auctionurl = $home_url.’customer/auctions/’;
$current_url = Mage::helper(‘core/url’)->getCurrentUrl();
[/sourcecode]
2. Then create a Auctions.php file on app\code\core\Mage\Customer\Block
[sourcecode language=”plain”]
<?php
class Mage_Customer_Block_Auctions extends Mage_Core_Block_Template
{
public function __construct()
{
parent::__construct();
$this->setTemplate(‘customer/auctions/auctions.phtml’);
Mage::app()->getFrontController()->getAction()->getLayout()->getBlock(‘root’)
->setHeaderTitle(Mage::helper(‘customer’)->__(‘Auctions’));
}
}
?>
[/sourcecode]
which new location will be app\code\core\Mage\Customer\Block\Auctions.php

3. Now create a Controller file for your Auctions on app\code\core\Mage\Customer\controllers location
[sourcecode language=”plain”]
<?php
class Mage_Customer_AuctionsController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
if (!$this->_getSession()->isLoggedIn()){
$this->_redirect(‘customer/account/login’);
return;
}
$this->loadLayout();
$this->getLayout()->getBlock(‘head’)->setTitle($this->__(‘Auctions’));
$this->renderLayout();
}

public function storeAction()
{
if (!$this->_getSession()->isLoggedIn())
{
$this->_redirect(‘customer/account/login’);
return;
}
$this->loadLayout();
$this->renderLayout();
}
protected function _getSession()
{
return Mage::getSingleton(‘customer/session’);
}
}
?>
[/sourcecode]
which new location will be app\code\core\Mage\Customer\controllers\AuctionsController.php

4. Now create your fronend design on app\design\frontend\bonsaisuperstore\default\template\customer\
Create a new folder where I use auctions folder and design your code for frontend on auctions.phtml
[sourcecode language=”plain”]
<?php echo ‘<h4>Welcome to webinbangla.</h4>’; ?>
[/sourcecode]
which new location will be app\design\frontend\bonsaisuperstore\default\template\customer\auctions\auctions.phtml

5. Now create a xml file on app\etc\modules\
Create a new folder where I use auctions folder and design your code for frontend on auctions.phtml
[sourcecode language=”plain”]
<?xml version=”1.0″?>
<config>
<modules>
<example>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</example>
</modules>
</config>
[/sourcecode]
which new location will be app\etc\modules\Auctions.xml

6. Then open our customer.xml from app\design\frontend\bonsaisuperstore\default\layout
Add below code before end of layout tag()
[sourcecode language=”plain”]
<customer_auctions_index translate=”label”>
<label>Customer My Account Auctions Form</label>
<update handle=”customer_account”/>
<reference name=”my.account.wrapper”>
<block type=”customer/auctions” name=”customer_auctions” template=”customer/auctions/auctions.phtml”/>
</reference>
</customer_auctions_index>
[/sourcecode]

I do it on my bonsaisuperstore.com project. After registration on this site you can see the new
tab on MY ACCOUNT PANEL. For registration, Click Here

Information

WebinBangla is a leading web solution provider and we work globally. Wel make sure our clients and customers avail maximum benefits by using our high quality services and complete packages.

  • Address: Pahartoli, Raozan, Chittagong.
  • Email: mamun005cse@gmail.com
  • Phone: +880 1738 914871

Working Hours

  • Monday - Friday - 9am to 5pm
  • Saturday - 9am to 2pm
  • Sunday - Closed