Call-back icon  Enterprise Sales: +1.310.775.2674 (N. America)   +44 20.3286.4137 (UK)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Cannot export reports to CSV or Excel
 
John R
Sr. Member
 
Total Posts:  90
Joined:  2008-08-21
 

I get this error when trying to export a sales report:

Cannot send headersheaders already sent in /home/store/public_html/dev/app/code/core/Mage/Reports/Model/Totals.phpline 2
Trace
:
#0 /home/store/public_html/dev/lib/Zend/Controller/Response/Abstract.php(114): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /home/store/public_html/dev/app/code/core/Mage/Adminhtml/Controller/Action.php(284): Zend_Controller_Response_Abstract->setHeader('Pragma', 'public', true)
#2 /home/store/public_html/dev/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php(62): Mage_Adminhtml_Controller_Action->_prepareDownloadResponse('sales.csv', '"Period","Numbe...')
#3 /home/store/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(349): Mage_Adminhtml_Report_SalesController->exportSalesCsvAction()
#4 /home/store/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php(143): Mage_Core_Controller_Varien_Action->dispatch('exportSalesCsv')
#5 /home/store/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Front.php(174): Mage_Core_Controller_Varien_Router_Admin->match(Object(Mage_Core_Controller_Request_Http))
#6 /home/store/public_html/dev/app/Mage.php(447): Mage_Core_Controller_Varien_Front->dispatch()
#7 /home/store/public_html/dev/index.php(52): Mage::run()
#8 {main}

Any idea?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jklina
Member
 
Avatar
Total Posts:  67
Joined:  2008-06-12
Philadelphia PA
 

Open app/code/core/Mage/Reports/Model/Totals.php and remove the space at the beginning of the file so that

<?php

is on the first line.

 
Magento Community Magento Community
Magento Community
Magento Community
 
michaelc
Member
 
Avatar
Total Posts:  54
Joined:  2008-05-21
Qld, Australia
 

Thanks @jklina,

I also found a space before <?php as well in the same file causing the same problem (app/code/core/Mage/Reports/Model/Totals.php)

So after removing the return on line 1 and the space before <?php the reports export works well.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2009 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
108698 users|390 users currently online|199765 forum posts