I have set the following Code within WebController.php
/**
* Export order grid to CSV format
*/
public function exportCsvAction()
{
$fileName = sprintf('stores-%s.csv', date('Ymd'));
$grid = $this->getLayout()->createBlock('adminhtml/web_web_grid');
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
}
I don’t know what is the problem that causing CSV not to be exported.
Following error is showing –
Fatal error: Call to a member function getCsvFile() on a non-object in
/var/www/projects/tmp/storelocator/app/code/local/Company/Web/controllers/Adminhtml/WebController.php
on line 0
Please help!
Thanks in Advance.
This line :
returns null. The error tells you it clearly :
Are you sure this ‘adminhtml/web_web_grid’ relates to a block ?
Do you have a folder/file
Web/Web/Grid.phpin theBlockfolder of the adminhtml module ?For example, if you didn’t overload the Mage_Adminhtml module, you should have a class named
Mage_Adminhtml_Block_Web_Web_Gridin the folderapp/code/local/Mage/Adminhtml/Block/Web/Web/Grid.phpthat’s what thecreateBlock('adminhtml/web_web_grid')is searching for