2011-11-01 173 views
0

我想更改添加产品按钮的操作。我已更改标签Magento:更改按钮动作

$this->_addButtonLabel = Mage::helper('abc')->__('Export'); 

我可以更改其操作,以便当用户单击此按钮时,它会转到我的自定义URL?

感谢

+0

翼函数你的意思是“加入购物车”按钮 – Gowri

+0

没有,添加产品按钮,在管理面板。实际上,我设计了一个自定义扩展,除了添加产品按钮外,它与产品列表类似。在Add Product按钮的位置将出现Export按钮,它将以XML格式导出产品。你明白吗??我的英语很差,为此感到遗憾。 – Adeel

回答

0

您需要添加以下代码

<module>/Block/Adminhtml/<module>/Grid.php

添加_prepareCollection函数内部下面的代码

$this->addExportType('*/*/exportCsv',Mage::helper('your_helper')->__('CSV')); 

your_helper:也许你的模块名

然后添加follo在您的控制器Controllers/Adminhtml/

public function exportCsvAction() { 
    $fileName = 'your_custom_file.csv'; 

    $content = $this->getLayout()->createBlock('your_custom_csv_grid')->getCsvFile(); 

    $this->_prepareDownloadResponse($fileName, $content); 

    } 

答案源和更详细here

+0

谢谢Gowri .. :) – Adeel