I am creating a link to a specific action in the admin section which will be emailed.

The task is run in a shell script called rules.php.

So I generate the admin url with:

Mage::helper("adminhtml")->getUrl("productmodule/adminhtml_trace/download", array('csv' => $filename));

When running the script from command line:

php -f rules.php apply

The generated url is:


Where I want the url to be:



Found the answer on Stackoverflow magento admin url from script

You need to set the type:

Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array(
  'order_id' => 123,
  '_type' => Mage_Core_Model_Store::URL_TYPE_WEB

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.