DPDBeNeLux / magento-DPD_Shipping

Let op: er zijn nieuwe DPD plugins (BETA versie) beschikbaar met belangrijke nieuwe functionaliteiten. De oude plugins zullen na Brexit niet meer goed functioneren, download daarom de nieuwe versie op Github/DPDconnect.
11 stars 10 forks source link

Cannot download DPD labels #26

Closed robinero closed 9 years ago

robinero commented 9 years ago

Hey mvgucht, are there any known issues with DPD labels and not being able to download them when they are created?

We're currently experiencing issues with this DPD module when trying to use the download all undownloaded. It simply says the label doesn't exist, even though we just created them with the generate label and complete action.

Thanks in advance.

mvgucht commented 9 years ago

This sometimes happens when the labels couldn't be written to the file system. please check if your labels are in the folder: /media/dpd/orderlabels and verify the dpd.log file in /var/log/

robinero commented 9 years ago

Thanks for the quick reply!

The files are actually written to /media/dpd/orderlabels, but the user is not being prompted to download them, the actual error currently shown in the Magento back-end when trying to do so is:

No undownloaded labels found.

All labels have been downloaded.

So the next step is figuring out why the user is not prompted to download the PDF's.

mvgucht commented 9 years ago

You can only use the batch download action once for each order.

Can you provide a print screen of your dpd order page and select the orders that you have tested with?

robinero commented 9 years ago

The selected orders do not have any labels downloaded yet.

Order created http://www.badjasparadijs.nl/media/test/dpd-step1.jpg

Select order and use Generate Label and Complete http://www.badjasparadijs.nl/media/test/dpd-step2.jpg

After label is created use Download all undownloaded, following is shown http://www.badjasparadijs.nl/media/test/dpd-step3.jpg

mvgucht commented 9 years ago

Strange.

is the php zip module enabled on your server?

robinero commented 9 years ago

php-pecl-zip-1.12.5 is installed and enabled.

robinero commented 9 years ago

We've managed to find the problem in _zipLabelPdfArray.

On line 218 in DPD/Shipping/Model/Adminhtml/DPDgrid.php returns a false because it cannot open a non-existing file. Manually creating undownloaded.zip will allow the action Download all undownloaded to download a zip with its contents.

Thank you for taking your time to help us.

mvgucht commented 9 years ago

Hey robinero,

thanks for the feedback.

It seems to me that the ZIPARCHIVE::CREATE flag should create the file, but I remember a previous problem with this, just can't recall the documentation. Perhaps we should check if the file exists in the function and don't rely on the $overwrite variable that is passed down.

 if ($zip->open($destination, $overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {