Add My Order link active in customer account

140 Views Asked by At

Right now in default magento when customer login into his/her account then Active menu shown to customer is Account Dashboard

I want to show My orders when customer login into account. I used this peace of code.

<customer_account>
<reference name="customer_account_navigation">
            <action method="setActive"><name>orders</name><path>sales/order/history/</path></action>
        </reference>
</customer_account>

but it didn't work. Please suggest me any solution or give me an alternate idea to do that.

2

There are 2 best solutions below

1
Mayur jadeja On

you can try below code in controller.

$this->loadLayout();

// add layout handle so that we will have the customer navigation on the right hand side

    $layout = $this->getLayout();
    $update = $layout->getUpdate();
    $this->addActionLayoutHandles();
    $update->addHandle('customer_account'); // add the customer navigation bar on the side
    $this->loadLayoutUpdates();
    $this->generateLayoutXml();
    $this->generateLayoutBlocks();
    $navigationBlock = $layout->getBlock('customer_account_navigation');
    // make sure we have an instantiation    
    if ($navigationBlock) {
        $navigationBlock->setActive('path/to/highlight'); // example: 'customer/address'
    }
    $this->_isLayoutLoaded = true;

    // render the layout
    $this->renderLayout();

So, please try this and let me know in case of any query.

Thanks

0
Abhinav Kumar Singh On

Open app\code\core\Mage\Customer\controllers\AccountController.php

Find code $this->_loginPostRedirect() in public function loginPostAction() and replace with $this->_redirect('sales/order/history/');