1

I am working on a module where i created some 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 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?

1 Answer 1

2

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.

3
  • I write in action node "external/controller/batchurl" . <?php class Demo_External_Adminhtml_ExternalController extends Mage_Adminhtml_Controller_Action { protected function batchurlAction() { $this->_redirectUrl('http://www.example.com/'); } } But not get the external url in the menu link.
    – Rat
    Commented Apr 29, 2016 at 7:02
  • try <<frontname>>/external/batchurl. Don't forget to replace frontname with your real frontname from config. It can be demo, external or demo_external. So you may probably get external/external/batchurl
    – zhartaunik
    Commented Apr 29, 2016 at 7:26
  • Please provide alternate for creating controller action and giving an anchor href directly onto the menu link. Commented Dec 15, 2017 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.