0

I want to store the product export csv file on a folder while generating from the admin panel.

Right now its only directly downloadable from the admin panel, but I want to store that file in a particular folder like "var/importexport".

Please advise.

3

You have to modify Mage_ImportExport_Adminhtml_ExportController::exportAction (of course don't change the file directly, but overwrite the controller update safe).

Change this part:

            return $this->_prepareDownloadResponse(
                $model->getFileName(),
                $model->export(),
                $model->getContentType()
            );

to:

            $filename = $model->getFileName();
            $content = $model->export();
            file_put_contents(Mage::getBaseDir('var') . DS . 'importexport' . DS . $filename, $content);
            return $this->_prepareDownloadResponse(
                $filename,
                $content,
                $model->getContentType()
            );

This should save the file in the given directory. Of course you can modify the filename $filename at that point.

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.