OliverH Posted January 27, 2015 Share Posted January 27, 2015 Hi, I'm writing a payment module for the company I work at and need to add additional information in the invoice. I'm pretty sure I need the displayPDFInvoice hook, but I can't find any information about this. Does anyone have a sample how to use it? Thanks, Oliver Link to comment Share on other sites More sharing options...
bellini13 Posted January 27, 2015 Share Posted January 27, 2015 Here is a sample from one of my modules. This code supports PS v1.4, v1.5 and v1.6. If you only need to support PS v1.5+ then remove the v1.4 code and make life easier public function hookPDFInvoice($params) { //this code obtains the id_order from the function parameter. The way to do this is different for PS v1.4 and v1.5+ $id_order = (int)$params['id_order']; //ps1.4 if (version_compare(_PS_VERSION_, '1.5', '>=')) { $order_invoice = $params['object']; if (!($order_invoice instanceof OrderInvoice)) return; $id_order = (int)$order_invoice->id_order; } //use this for PS v1.5+ if (version_compare(_PS_VERSION_, '1.5', '>=')) return 'your content goes here. You can also choose to use smarty and templates if it is complex'; //use something like this for PS v1.4 $params['pdf']->SetFont(PDF::fontname(), '', 9); $params['pdf']->Ln(3); $params['pdf']->Cell(150, 6, Tools::iconv('utf-8', PDF::encoding(), 'some content here'), 1, 0, 'R', 1); $params['pdf']->Cell(0, 6, 'some other content here', 1, 2, 'L', 1); $params['pdf']->Ln(0); } 1 Link to comment Share on other sites More sharing options...
OliverH Posted January 27, 2015 Author Share Posted January 27, 2015 Ah, thanks! This is just what I needed! And it almost looks like I imagined, it would work. 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