Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add custom active links to customer account navigation in Magento
<?php
class My_ModuleBlock_Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation
{
/**
* Is there a specific active link?
*
* @var
*/
protected $_activeLink;
/**
* Set active link to this navigation
*
* @param string $linkName
*/
public function setActiveLink($linkName)
{
$this->_activeLink = $linkName;
}
/**
* Overloaded in order to force link active display
* when there is an active link explicity set
*
* @param string $link
* @return bool
*/
public function isActive($link)
{
$isActive = parent::isActive($link);
if(!$isActive && $link->getName() == $this->_activeLink) {
$isActive = true;
}
return $isActive;
}
}
?>
@webspeaks

This comment has been minimized.

Copy link

webspeaks commented Dec 26, 2015

Thanks. Its an awesome trick :)

@erikkubica

This comment has been minimized.

Copy link

erikkubica commented Mar 3, 2016

Thanks for sharing you method, I had same problem and i found your solution as first on google. But since i wanted some shorter way i found this solution:

<reference name="customer_account_navigation">
    <action method="setActive">
        <path>help/CustomerCare/</path>
    </action>
</reference>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.