flurrybox / enhanced-privacy

Magento 2 Enhanced Privacy extension for easier compliance with GDPR. Allows customers to delete, anonymize, or export their personal data.
https://flurrybox.com
GNU General Public License v3.0
43 stars 11 forks source link

Export of data fails #1

Closed rubenelshof closed 6 years ago

rubenelshof commented 6 years ago

When trying to export the data from a account i get a message saying "Something went wrong. Try again later.". I am also redirected to the 404 page.

I can not find anything in the logs either.

Using Magento 2.2.4

Any clues?

frvoya commented 6 years ago

Hello, Same problem on Magento 2.2.4. Export data give message "Something went wrong. Try again later." with 404 page. I found data zip in the root of my server. Thank you!

zamocom commented 6 years ago

Hi, I have the same problem with Magento 2.2.4, something new?

NoSGR commented 6 years ago

Hi, i've also have the same problem on magento 2.2.0!

I also found customer data in a zip in the root folder.

flurrybox commented 6 years ago

Could not reproduce issue with Magento 2.2.4 Make sure that 'pub' folder is writable.

GrizzliGourmet commented 6 years ago

Hello,

Edit this file : 'app/code/Flurrybox/EnhancedPrivacy/Controller/Export/Export.php

Replace the downloadZip function by this :

protected function downloadZip()
    {
        $customer = $this->customerRepository->getById($this->session->getCustomerId());
        $date = $this->getDateStamp();

        $zipFileName = 'pub/customer_data_' . $date . '.zip';

        foreach ($this->processors as $name => $processor) {
            if (!$processor instanceof DataExportInterface) {
                continue;
            }

            $file = $name . '_' . $date . '.csv';

            $this->createCsv($file, $processor->export($customer));
            $this->zip->pack($file, $zipFileName);
            $this->deleteCsv($file);
        }
        $zipFileName = substr($zipFileName, 4);

        $this->fileFactory->create(

            $zipFileName,
            [
                'type' => 'filename',
                'value' => $zipFileName,
                'rm' => true,
            ],
            DirectoryList::PUB,
            'zip',
            null
        );
    }

It should work!

rubenelshof commented 6 years ago

Can confirm the changes by @MAX1M9K5 fixes the issue.

frvoya commented 6 years ago

I confirm, issue fixed by @MAX1M9K5

flurrybox commented 6 years ago

Code provided by @MAX1M9K5 fixes issue for ones that are not using 'pub' folder as application entry point. Because of that, changes won't be implemented in master branch (its recommended to use 'pub' as application entry point).