1

Magento 2.3.3 Go to System -> Exports -> Select "Customer address" -> Generate export.

A new file is generated and is visible in the table, but when I try to export or delete the file, I get the error

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): There are no export file with such name customer_address_20200612_122735.csv

But the file exists in var/export folder. There is issue with the permissions of the newly generated file.

The permissions are

-rw-rw-r--

Which means the file has no permissions to execute. I research a lot on this issue but go nothing.

FYI: I already did chmod -R 777 var

But the issue is for newly generated files, after giving permissions.

Can anyone help?

  • Did you check what group is assigned to the newly created file ? Also, have you tried adding write permission to var/export. Not just var – Abdul Pathan Jun 25 '20 at 14:16
  • @AbdulPathan, I am using a docker setup, so the group and owner is root. And I tried with permissions on var/export as well. Thanks! – anujeet Jun 25 '20 at 14:32
  • So when you add the 777 permission for file manually, you are able to delete it successfully ?? – Abdul Pathan Jun 25 '20 at 14:39
  • @AbdulPathan, yes it works fine for files that exists and I give permissions. But after giving permissions, if I export a new file, the new file does not get the permissions correctly. – anujeet Jun 26 '20 at 5:44
0

Temporary solution for products export:

Edit execute function in vendor/magento/module-import-export/Controller/Adminhtml/Export/Export.php

public function execute()
{
    if ($this->getRequest()->getPost(ExportModel::FILTER_ELEMENT_GROUP)) {
        try {
             $model = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
             $model->setData($this->getRequest()->getParams());
             $this->sessionManager->writeClose();
            return $this->fileFactory->create(
              $model->getFileName(),
              $model->export(),
              \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR,
              $model->getContentType()
             );
           
        } catch (\Exception $e) {
            $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
            $this->messageManager->addError(__('Please correct the data sent value.'));
        }
    } else {
        $this->messageManager->addError(__('Please correct the data sent value.'));
    }
    /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
    $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
    $resultRedirect->setPath('adminhtml/*/index');
    return $resultRedirect;
}
  • Modifying the core Magento file is not recommended at all. You can always create a custom module for overriding the core code functionality. – Bhaumik Upadhyay Aug 13 '20 at 9:03

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.