Using getUrl in a Magento script shell

I created a script called customscript.php in the /shell directory. This script extends Mage_Shell_Abstract .

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

If I do this:

 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 to remove customscript.php from url without using str_replace() result?

+4
source share
1 answer

you can use the _type parameter 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 )); 
+9
source

Source: https://habr.com/ru/post/1501849/


All Articles