public function exportAction()
    {
        $orders = $this->getRequest()->getPost('order_ids', array());

        try {
            // Build the CSV and retrieve its path
            $filePath = Mage::getModel('australia/shipping_carrier_clickandsend_export_csv')->exportOrders($orders);

            // Download the file
            $this->_prepareDownloadResponse(basename($filePath), file_get_contents($filePath));
        } catch (Exception $e) {
            Mage::getSingleton('core/session')->addError($e->getMessage());
            $this->_redirect('adminhtml/sales_order/index');
        }
    }
public function exportAction()
    {
        $orders = $this->getRequest()->getPost('order_ids', array());

        try {
            // Build the CSV and retrieve its path
            $filePath = Mage::getModel('australia/shipping_carrier_clickandsend_export_csv')->exportOrders($orders);

            // Download the file
            $this->_prepareDownloadResponse(basename($filePath), file_get_contents($filePath));
        } catch (Exception $e) {
            Mage::getSingleton('core/session')->addError($e->getMessage());
            $this->_redirect('adminhtml/sales_order/index');
        }
    }
public function exportAction ( ) { $ orders = $ this -> getRequest ( ) -> getPost ( 'order_ids' , array ( ) ) ; try { // Build the CSV and retrieve its path $ filePath = Mage :: getModel ( 'australia/shipping_carrier_clickandsend_export_csv' ) -> exportOrders ( $ orders ) ; // Download the file $ this -> _prepareDownloadResponse ( basename ( $ filePath ) , file_get_contents ( $ filePath ) ) ; } catch ( Exception $ e ) { Mage :: getSingleton ( 'core/session' ) -> addError ( $ e -> getMessage ( ) ) ; $ this -> _redirect ( 'adminhtml/sales_order/index' ) ; } }
Export Orders to CSV

This action exports orders to a CSV file and downloads the file.
The orders to be exported depend on the HTTP POST param "order_ids".
Export Orders to CSV