Mjolnir Posted August 21, 2017 Share Posted August 21, 2017 Hi ! I should edit prestashop invoices. I currently use override, and I see my changes when I go through "Orders->Orders->Generate invoice". But, when I go through "Orders->Invoices->Generate invoices by date", it's not working correctly : I have some payment by instalment, and for this I want to write all payment date. This is working for 1 invoice, but when I do it with more, all invoices take information from the last. For informations : I override "/controllers/admin/AdminPdfController.php" on "generateInvoicePDFByIdOrderInvoice" function i send my data to my template with that: $this->context->smarty->assign('dates_prelevement', $dts); Someone can help me to found how can I send my datas correctly ? Thanks in advance. Link to comment Share on other sites More sharing options...
Scully Posted August 23, 2017 Share Posted August 23, 2017 (edited) Which is the prestashop version you have in use? I would rather use the override for this class: HTMLTemplate.php Just tested for multiple invoices and it works. Edited August 23, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
Mjolnir Posted August 23, 2017 Author Share Posted August 23, 2017 (edited) This is Prestashop 1.6.1.4 I said mistake, I use this : public function processGenerateInvoicesPDF(){ $order_invoice_collection = OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')); if (!count($order_invoice_collection)) { die(Tools::displayError('No invoice was found.')); } foreach ($order_invoice_collection as $o) { $order = new Order($o->id_order); $payment_type = $order->getOrderPayments(); if($payment_type[0]->payment_method == "Atos Nx") { $o->paymentType = "ATOS NX"; } else { $o->paymentType = "ATOS"; } } Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => array($order_invoice_collection))); $this->generatePDF($order_invoice_collection, PDF::TEMPLATE_INVOICE); } This works, but all invoices take informations from the last. Did you see something bad ? Thanks for your help. Edited August 23, 2017 by Mjolnir (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 23, 2017 Share Posted August 23, 2017 (edited) Your second post has nothing to do with your first one. But long story short: you are in the wrong override. Edited August 23, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
Mjolnir Posted August 24, 2017 Author Share Posted August 24, 2017 oh, ok, I will search something else. Thanks 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