MOUAZZAZ Zineb Posted October 19, 2022 Share Posted October 19, 2022 (edited) Hello, I am coding a module to send a PDF invoice of a purchase on Google Drive. However, when I want to create a PDF, it sends me this error (it always comes up when I want to make the render): I specify that it worked on version 1.6 of Prestashop but when I made the update to 1.7 I found myself with this problem. Here is my code : public function saveInvoiceToDrive(int $id_order) { $context = Context::getContext(); $result = false; $order = new Order($id_order); $invoice_collection = $order->getInvoicesCollection(); // Retrieves the name of the invoice /** @var OrderInvoice $invoice */ foreach ($invoice_collection as $invoice) { $file_name = $invoice->getInvoiceFilename($id_order); $filename = $file_name['invoice']; $nameInvoice = $filename['name']; $order_file = _PS_MODULE_DIR_ . $this->name . '/invoices/files/' . $nameInvoice; // Create the invoice in pdf $pdf = new PDF($invoice, PDF::TEMPLATE_INVOICE, $this->context->smarty); $invoice_content = $pdf->render(false); // Save the invoice as a pdf file in the desired folder file_put_contents($order_file, $invoice_content); // Send to drive if (is_file($order_file)) { $result = $this->toGoogleDrive($order_file, 'pdf'); } } return $result; } Edited October 19, 2022 by MOUAZZAZ Zineb (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted October 20, 2022 Share Posted October 20, 2022 Hi. https://github.com/PrestaShop/PrestaShop/issues/22215#issuecomment-748894921 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now