I want to deep understand prestahop inside structure and amend some parts. I am stoped in the PDF. I want can't find the controller used to handle the AdminPdf and generateDeliverySlipPDF
{if $order->delivery_number}
<a class="btn btn-default _blank" href="{$link->getAdminLink('AdminPdf')|escape:'html':'UTF-8'}&submitAction=generateDeliverySlipPDF&id_order={$order->id}">
<i class="icon-truck"></i>
</a>
{/if}
Who can help me figure out the inside processes? I can't find the methods to handle generateDeliverySlipPDF.
thank you for this topic,
I would like to ask you for the case of generating pdf in front?
i.e this is a part of history.tpl
i found $order.details.invoice_url is define in OrderPresenter.php and OrderPresenter use HistoryController to get the invoice_url.
So i take a look in historyController
getPageLink use "pdf-invoice" ,i take a look for getPageLink Method and see that "pdf-invoice" is a controller... the trouble is i don't know where is this controller? help please
AdminPdfController
is located at/controllers/admin/AdminPdfController.php
.The
submitAction=generateDeliverySlipPDF
part of the url will call the methodprocessGenerateDeliverySlipPDF()
inside this controller.Here is this method:
In this Controller you'll find other methods as this one to generate Invoices, Order, ... and other PDFs.
Feel free to ask if you need more informations.
EDIT:
If you want to change format in a proper way you'll have to override those classes:
/override/classes/pdf/PDFGenerator.php
:/override/classes/pdf/PDF.php
:/override/controllers/admin/AdminPdfController.php
:Now you can specify the format for each PDF. You will find informations about
$format
at this placeThis code has not been tested but should work as expected. Let me know if you encounter any issue.
You will need to delete
/cache/class_index.php
after adding those overrides to clear Prestashop internal classes path cache.