Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using getUrl in a Magento shell script

Tags:

shell

magento

I've created a script named customscript.php in the /shell dir. This script extends Mage_Shell_Abstract.

When I use getUrl() inside this script, Magento adds customscript.php in the URL.

If I do:

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

I have:

http://mysite.com/customscript.php/admin/sales_order/view/order_id/123/key/{secret key}

How can I remove customscript.php from the URL without using str_replace() the result?

like image 970
paco moreau Avatar asked Jan 12 '23 09:01

paco moreau


1 Answers

you can use '_type' param for getUrl() function as follows:

Mage::helper('adminhtml')->getUrl("adminhtml/sales_order/view", array(
  'order_id' => 123,
  '_type' => Mage_Core_Model_Store::URL_TYPE_WEB
));
like image 124
Alex K Avatar answered Feb 21 '23 13:02

Alex K