1

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:

https://mysite.dev/rules.php/productmodule/adminhtml_trace/download/csv/file_1/key/3f5f888f5b6f191ab32e496f7e2bafd8/

Where I want the url to be:

https://mysite.dev/index.php/productmodule/adminhtml_trace/download/csv/file_1/key/3f5f888f5b6f191ab32e496f7e2bafd8/

1

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.