2014-10-01 42 views
2

我想添加一个确认弹出到Magento管理中的现有按钮。当你按下捕捉时,大声问你是否确定。我在adminhtml文件夹中找到了该按钮的代码,并且不知道更多。我发现你可以使用onclick参数来启动一个js函数,但是这个参数已经被magento设置了。 这里是按钮的代码magento管理确认弹出发票创建

if ($this->_isAllowedAction('capture') && $this->getInvoice()->canCapture()) { 
     $this->_addButton('capture', array(
       'label'  => Mage::helper('sales')->__('Capture'), 
       'class'  => 'save', 
       'onclick' => 'setLocation(\''.$this->getCaptureUrl().'\')' 
      ) 
     ); 
    } 

回答

2

必须更换'onclick' => 'setLocation(\''.$this->getCaptureUrl().'\')'


'onclick' => "confirmSetLocation('{$message}', '{$this->getCaptureUrl()}')",

1
'onclick' => "confirmSetLocation('Are you sure you want to do this?', '{$this->getUrl('*/*/delete')}')",