5

I want to get the current url of an admin panel page. I tried the folowing.

$currentUrl = Mage::helper('adminhtml')->getUrl();

But it's not returning the current url.

8

Try this :

<?php echo $magentoCurrentUrl = Mage::helper('core/url')->getCurrentUrl();?>
6

When we see url in magento admin we can see it is formed with secret keys and cannot be accessed without that, below is the simple way to get any url for admin with keys.

echo Mage::helper("adminhtml")->getUrl("module_name/controller_name/action_name/",array("param1"=>1,"param2"=>2));
  Mage::helper("adminhtml")->getUrl("adminshipper/process/index");

but to get current url use

echo $magentoCurrentUrl = Mage::helper('core/url')->getCurrentUrl();  
0

you can get using following code.

if (!in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), array('cms_index_noRoute', 'cms_index_defaultNoRoute'))) {
    $currentUrl = Mage::helper('core/url')->getCurrentUrl();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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