how to download customer csv including shipping address in manage customers grid?
-
12-12-2019 - |
Question
I have idea we can get including customer address from data flow profiles export customers.
but client requirement is getting customer information including shipping address from customer grid.
Note: i dont want shipping address columns in grid.but i want columns only in csv.
can you give some over all idea to start this task?
Solution
You have to extend/rewrite the Mage_Adminhtml_CustomerController class.
public function exportCsvAction()
{
$fileName = 'customers.csv';
$content = $this->getLayout()->createBlock('adminhtml/customer_grid')
->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);
}
With you own action:
public function exportCsvAction() // Modified version
{
$fileName = 'customers.csv';
$content = $this->getLayout()->createBlock('adminhtml/customer_modified_grid') // call to a new block class.
->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);
}
The extend the Mage_Adminhtml_Block_Customer_Grid with your own :
and the in the protected function _prepareColumns() you can put the csv columns!
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange