Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herveguetin/11374425 to your computer and use it in GitHub Desktop.
Save herveguetin/11374425 to your computer and use it in GitHub Desktop.
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
Copy link

Thanks. Its an awesome trick :)

@erikkubica
Copy link

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