firegento-pdf
firegento-pdf copied to clipboard
PDFs as ZIP
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
I have implement a module here. Will open source it and link it in the wiki
I think we should have this feature in the core!
I'm quite sure we discussed it and found another result :stuck_out_tongue_winking_eye: will add it :)
Really? Oh boy, I am getting old. Sorry for that. Thanks!
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...
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?
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.
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() ); }
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..
I do not need this feature, but I am fine with merging it :)