I have changed the transaction grid so I needed to do it in local folder because they were comming from Core files. here is the folders structure

enter image description here

so in the controller I have done this:

   public function exportCsvAction()
    $fileName = 'Transaction.csv';
    $grid = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Sales_Transactions_Grid');
    $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());

and in the Grid.php :

    class Mage_Adminhtml_Block_Sales_Transactions_Grid extends Mage_Adminhtml_Block_Widget_Grid
        protected function _prepareColumns()
            $helper = Mage::helper('Adminhtml');
            //some code
            $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
            return parent::_prepareColumns();
//some code and functions

it does not work I could not see anything in log files. I'm not sure why we have this path */*/exportCsv what does it mean? well it worked in all modules so I just did it but i don't understand it.

also I do not know about the $helper, what should be written I tried Mage_Adminhtml but it gave me error of something like Mage_Mage_Adminhtml_... so I guessed it should be only Adminhtml

I also did this:

 public function exportCsvAction()
          $fileName   = 'Transaction.csv';
        $content    = $this->getLayout()->createBlock('adminhtml/sales_transactions_grid')

        $this->_prepareDownloadResponse($fileName, $content);


no result 404 not found

I logged a message in this function and I have realized that it does not even go to the exportCsvAction function for some reason

How can I fix it? Thank you.


The problem is that you cannot override controllers in app/code/local like other classes because they are not loaded with the Magento autoloader but included explicitly (Hint: their paths don't follow the same convention, controllers is not part of the class name)

So, the original controller is used and that's why the exportCsv action does not exist.

You will have to write a proper module instead of working on a copy in app/code/local, at least for the controller. You can add your own controller to the adminhtml route, as explained here: Override a controller in Adminhtml

As for your question, what */*/exportCsv means: this denotes a route, which contains of frontname, controller and action. * means "same as current", so it is the route for the exportCsvAction() action method in the current controller.

| improve this answer | |
  • Thank you very much, I solved the problem with your guidance ^_^ – Nickool Jul 13 '15 at 22:33

You did a mistake here

$helper = Mage::helper('Adminhtml');

You have to define adminhtml in small letter

$helper = Mage::helper('adminhtml');

So only your getting Mage_Mage_Adminhtml is not a class.

$this->addExportType('*/*/exportCsv', $helper->__('CSV')); 
$this->addExportType('*/*/exportExcel', $helper->__('Excel XML'));
| improve this answer | |
  • Thank you, I am still having problem, it redirects me to a page and not working – Nickool Jul 10 '15 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.