bugrakorkmaz Posted May 21, 2013 Share Posted May 21, 2013 Hi, I am trying to customize invoice. I did all changes that I want but now i need some professional help. I want to write, the reading of the total price, on invoice. For example if total of order on invoice is 102$, I want to write OneHundredAndTwoDollars on invoice. I have the php function for this purpose but I don' t know how to use this function inside prestashop. I want to learn: Where to put my custom php file? How to use my custom php function inside invoice.tpl file? Please guide me. Thanks. Link to comment Share on other sites More sharing options...
vekia Posted May 21, 2013 Share Posted May 21, 2013 it isn't possible to use php code in invoice.tpl file all you have to to is to modify the PDFInvoiceController.php Link to comment Share on other sites More sharing options...
bugrakorkmaz Posted May 22, 2013 Author Share Posted May 22, 2013 vekia, thanks for your replay. i don't want to use php code inside the tpl file. I want to put my php code under prestashop folders and use the return of this code inside the tpl file inside { } tags.So i want to learn where can i put my php file and how can i use the return of this code inside the tpl file. I hope i explain clearly. Regards. Link to comment Share on other sites More sharing options...
vekia Posted May 22, 2013 Share Posted May 22, 2013 pdfinvoicecontroller.php public function display() { $order_invoice_list = $this->order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id); $pdf->render(); } Link to comment Share on other sites More sharing options...
bugrakorkmaz Posted May 23, 2013 Author Share Posted May 23, 2013 Dear Vekia, Thanks again. But since I am new on Presta coding I really need your help.The code you sent was abit complicated for me. My question is simple.. On invoice I would like to show some extra information but this information came from my php function. The question is; Where can I put my php functions and show the result of this function on invoice.tpl..? Thanks alot and sorry for bothering.. Link to comment Share on other sites More sharing options...
vekia Posted May 23, 2013 Share Posted May 23, 2013 $order_invoice_list = $this->order->getInvoicesCollection(); with code above you create a variable with invoice parameteres. As you can see - parameteres were generated in order class in the getInvoicesCollection(); you can add own code to this function, which will add new variables to the return (will put them to the $order_invoice_list variable) then you will be able to use variables in invoice tpl file Link to comment Share on other sites More sharing options...
bugrakorkmaz Posted May 23, 2013 Author Share Posted May 23, 2013 Thanks I will try that and let you know. May I also ask one small question? If a customer adds products to cart and the total cost is lets say ; 30$, then I would like to add 5 $ for extra service charge.. I mean If the totalcost is < 30$ I will add 5$ if the totalcost is >= 30$ I will not add anything.. Is it possible to do this_? Thanks alot Link to comment Share on other sites More sharing options...
garyjj127 Posted November 25, 2014 Share Posted November 25, 2014 Is there a way of displaying a products features in the invoice? We have an internal SKU (which we use with the REFERENCE heading, and put the individual product SKU in the products features. Is there a way of displaying this in the invoice? Link to comment Share on other sites More sharing options...
tuk66 Posted November 27, 2014 Share Posted November 27, 2014 You can start with http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1668332 and adapt the code for the original invoice. 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