Magento add external URL to menu admin

I was just trying to add an external link on my admin menu panel and figured out that there is no direct option to add, we need to override some functionality to achieve this. So here is the solution I found out for the same. Unfortunately, we need to have a small module for this functionality:-

Firstly we need to overwrite the _buildMenuArray() function of Mage_Adminhtml_Block_Page_Menu class to add a condition for external url. So let’s start our modification:-

Create your config file to override the page menu class, as shown in below code:


Add a block file to override page menu, review line 40 for the modification:-

class W3solver_Menulink_Block_Adminhtml_Page_Menu extends Mage_Adminhtml_Block_Page_Menu {
     * Recursive Build Menu array
     * @param Varien_Simplexml_Element $parent
     * @param string $path
     * @param int $level
     * @return array
    protected function _buildMenuArray(Varien_Simplexml_Element $parent=null, $path='', $level=0)
        if (is_null($parent)) {
            $parent = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');

        $parentArr = array();
        $sortOrder = 0;
        foreach ($parent->children() as $childName => $child) {
            if (1 == $child->disabled) {

            $aclResource = 'admin/' . ($child->resource ? (string)$child->resource : $path . $childName);
            if (!$this->_checkAcl($aclResource) || !$this->_isEnabledModuleOutput($child)) {

            if ($child->depends && !$this->_checkDepends($child->depends)) {

            $menuArr = array();

            $menuArr['label'] = $this->_getHelperValue($child);

            $menuArr['sort_order'] = $child->sort_order ? (int)$child->sort_order : $sortOrder;

            /* condition added to manage external url*/
            if ($child->external_url) {
                $menuArr['url'] = (string)$child->external_url;
            } else if ($child->action) {
                $menuArr['url'] = $this->_url->getUrl((string)$child->action, array('_cache_secret_key' => true));
            } else {
                $menuArr['url'] = '#';
                $menuArr['click'] = 'return false';

            $menuArr['active'] = ($this->getActive()==$path.$childName)
                || (strpos($this->getActive(), $path.$childName.'/')===0);

            $menuArr['level'] = $level;

            if ($child->children) {
                $menuArr['children'] = $this->_buildMenuArray($child->children, $path.$childName.'/', $level+1);
            $parentArr[$childName] = $menuArr;


        uasort($parentArr, array($this, '_sortMenu'));

        while (list($key, $value) = each($parentArr)) {
            $last = $key;
        if (isset($last)) {
            $parentArr[$last]['last'] = true;

        return $parentArr;


Here is code of my menu:-

        <menulink translate="title" module="menulink">
            <title>Menu Link</title>
                <menulink translate="title" module="menulink">
                    <title>Menu Link</title>

Just put down your comment if you face any issue.


  1. Hey there, You’ve performed an excellent job. I will definitely digg it and in my opinion recommend to my friends. I’m confident they will be benefited from this web site.


Leave a Comment.