I have just added a custom select column in sales order grid. It is displaying in sales order grid correctly and also filter is working fine with this column. Problem is coming when export the sales order.

Problem : I'm not able to open/download sales order export csv. It is showing network error

I have debug the export thing and found that issue is arising from Magento\Framework\App\Response\Http\FileFactory class during setting up the response header.

The whole response header is

            ->setHeader('Pragma', 'public', true)
            ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
            ->setHeader('Content-type', $contentType, true)
            ->setHeader('Content-Length', $contentLength === null ? strlen($content) : $contentLength, true)
            ->setHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"', true)
            ->setHeader('Last-Modified', date('r'), true);

If I comment/remove the following line from above response header then it is working fine

->setHeader('Content-Length', $contentLength === null ? strlen($content) : $contentLength, true)

It is working fine earlier, it is coming from 2 to 3 days.

Question 1 : Why this is coming now, If it is already working fine ?

Question 2 : Why this is working fine by commenting the length header ?

Any help would be appreciated !

Thanks in advance.

Your Answer

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

Browse other questions tagged or ask your own question.