且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置外部URL链接到Magento管理菜单

更新时间:2023-11-30 16:27:28

<action>标记内,您可以放置​​模块的module/controller/action.

然后创建此动作并添加如下内容:

public function locationAction()
{
    $this->_redirectUrl('http://www.example.com/');
}

请参见 Mage_Core_Controller_Varien_Action::_redirectUrl 用于Magento控制器操作中的标准重定向实现.

I am working on a module where I have created one menu in Magento admin using adminhtml.xml.

Now I want to link one of the menu to an external URL and set target="blank". But I'm not sure how to do it in adminhtml.xml. Here is my code.

<?xml version="1.0"?>
<config>
    <menu>
        <system>
            <children>
                <convert translate="title">
                    <children>
                        <importmagmi translate="title" module="importexport">
                            <title>MagMi Importer</title>
                            <action><url helper="https://externalurl.com"/></action>
                            <sort_order>100</sort_order>
                        </importmagmi>
                    </children>
                </convert>
            </children>
        </system>
    </menu>
</config>

When i am checking its adding current domain name before external url. ex: http://mydomainname.com/https://externalurl.com

I am wondering how to set only external URL ?

Inside <action> tag you can put module/controller/action of your module.

Then create this action and put something like this:

public function locationAction()
{
    $this->_redirectUrl('http://www.example.com/');
}

See Mage_Core_Controller_Varien_Action::_redirectUrl for the standard redirect implementation in Magento controller actions.