Question

I made a new button in adminhtml by extending *Mage_Adminhtml_Block_Sales_Order* and now i want to have some functionality in it.

    class Module_Parcel_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Sales_Order 
    {
        public function  __construct() {

            $this->_addButton('Parcel Sync', array(
                'label'     => Mage::helper('Sales')->__('Parcel Sync'),
                'onclick'   => 'window.open(\'/magento/app/code/local/Module/Parcel/Controller/Sync.php\')',
                'class'     => 'go'
            ), 0, 100, 'header', 'header');

            parent::__construct();
        }
    }

You can see here how i implement my button, the onclick function is wrong because i can not acces my controller like that. How do i solve this?

EDIT this is my controller

class Module_Parcel_IntegerController extends Mage_Core_Controller_Front_Action
{
    public function multiplyAction()
    {
        echo 'Works';
    }
}

Do i need to add this controller to config.xml to get this code working? (thx to magik)

Mage::helper('adminhtml')->getUrl("Module_Parcel/adminhtml_controller/sync"); 
Was it helpful?

Solution

You can use following -

Mage::helper('adminhtml')->getUrl("modulename/adminhtml_controller/action");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top