Jump to content

duplicate Invoice PDF with new tpl


wakabayashi

Recommended Posts

How can I duplicate the Generate Invoice PDF Process in Prestashop 1.6? I want to use a different tpl file, but the rest should stay the same.

Let me explain, what I already did:

  1. HTMLTemplateInvoice as HTMLTemplateMahnung and changed Class Name.
  2. Added: const TEMPLATE_MAHNUNG = 'Mahnung'; to the file classes/pdf/PDF.php
  3. Created file mahnung.tpl in root/pdf folder
  4. Added to AdminPdfController.php:

public function processGenerateMahnungPdf() { 
if (Tools::isSubmit('id_order')) { $this->generateMahnungPDFByIdOrder(Tools::getValue('id_order')); } 
elseif (Tools::isSubmit('id_order_invoice')) { $this->generateInvoicePDFByIdOrderInvoice(Tools::getValue('id_order_invoice')); } 
else { die(Tools::displayError('The order ID -- or the invoice order ID -- is missing.')); [spam-filter]

AND

public function generateMahnungPDFByIdOrder($id_order)
{
$order = new Order((int)$id_order);
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError('The order cannot be found within your database.'));
}

$order_invoice_list = $order->getInvoicesCollection();
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
$this->g
eneratePDF($order_invoice_list, PDF::TEMPLATE_MAHNUNG);
}

But it's not working. It just doesn't generate the PDF. I get a blank Page...

Any help?

Edited by wakabayashi (see edit history)
Link to comment
Share on other sites

  • 2 years later...

Hey wakabayashi, 

Did you find out the solution ? i want to do the same but i am stuck as well !

When you say : " HTMLTemplateInvoice as HTMLTemplateMahnung and changed Class Name."  what is the name of the class then in your new file ?

Thks

Link to comment
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
×
×
  • Create New...