firegento-pdf icon indicating copy to clipboard operation
firegento-pdf copied to clipboard

PDFs as ZIP

Open Schrank opened this issue 10 years ago • 10 comments

At the moment you can get all PDFs which are checked in the invoice view (or wherever) as a long PDF. I would like to implement an alternative: get single PDFs in a zip file

Schrank avatar Nov 16 '14 17:11 Schrank

I have implement a module here. Will open source it and link it in the wiki

Schrank avatar May 29 '15 08:05 Schrank

I think we should have this feature in the core!

sprankhub avatar May 29 '15 08:05 sprankhub

I'm quite sure we discussed it and found another result :stuck_out_tongue_winking_eye: will add it :)

Schrank avatar May 29 '15 08:05 Schrank

Really? Oh boy, I am getting old. Sorry for that. Thanks!

sprankhub avatar May 29 '15 08:05 sprankhub

Hi it seems (but I can be wrong) that this interesting feature (PDFs as ZIP) has not been currently included (merged) in the development branch (I downloaded). Is there a reason for this ? Thanks for your answer to this, may be, naive question...

zuiko avatar Nov 09 '17 13:11 zuiko

I guess @sprankhub and me decided to have this as a second plugin, but I can't remember :-/

@sprankhub What do you think? refurbish PR and merge it?

Schrank avatar Nov 09 '17 13:11 Schrank

I can't see any disadvantage to have this useful option in the main code... But the code of the main branch may have changed slightly, so there are, may be, a few precautions to take.

zuiko avatar Nov 09 '17 13:11 zuiko

Little suggestion in order to improve invoices PDF files names in the ZIP file (currently it's the order number which is not the best in my mind), we can use the backoffice given individual file name: in /app/code/community/FireGento/Pdf/Model/ZippedInvoice.php private function addInvoice(ZipArchive $zip, $invoice) { $invoicefilename = Mage::helper('firegento_pdf')->getExportFilename('invoice', $invoice); //zuiko $zip->addFromString( //$invoice->getOrder()->getIncrementId() . '.pdf', //zuiko $invoicefilename, //zuiko Mage::getModel('sales/order_pdf_invoice')->getPdf( array($invoice) )->render() ); }

zuiko avatar Nov 09 '17 17:11 zuiko

In /app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/OrderController.php and /app/code/community/FireGento/Pdf/controllers/Adminhtml/Sales/InvoiceController.php I suggest to change: $file = tempnam("tmp", "zip"); into: $file = tempnam(Mage::getBaseDir('tmp'), "zip"); Because on some configurations the PHP standard tmp directory can be not allowed to write. The result is an empty zip file to download. The Magento tmp directory is always allowed to write to Magento..

zuiko avatar Nov 09 '17 22:11 zuiko

I do not need this feature, but I am fine with merging it :)

sprankhub avatar Nov 13 '17 07:11 sprankhub