Jump to content

Invoices edit issue


Mjolnir
 Share

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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 by Mjolnir (see edit history)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More