B-219 Sec-55 Noida, India
+918010221733

Magento – Add Export to csv button in form

This code is add button export to csv in form same as  grid page.

public function getElementHtml()
{

$buttonBlock = $this->getForm()->getParent()->getLayout()->createBlock(‘adminhtml/widget_button’);

$params = array(
‘website’ => $buttonBlock->getRequest()->getParam(‘website’)
);

$data = array(
‘label’     => Mage::helper(‘adminhtml’)->__(‘Download sample CSV’),
‘onclick’   => ‘setLocation(”.Mage::helper(‘adminhtml’)->getUrl(“*/*/exportCsv”, $params) . ‘conditionName/’ +’/tablerates.csv’ )’,
‘class’     => ”,
);
$html = $buttonBlock->setData($data)->toHtml();
return $html;
}

Enjoy.. 😀

(Visited 49 times, 1 visits today)

Leave a reply