ElFamosoWilli Posted February 7 Share Posted February 7 Hello everyone I am currently trying to find what are the classes to override to change how the pdf are generated and distributed to the customer , I want to keep the same links but I want to give an other pdf that the one generated by prestashop , how could it be done ? Thank you everyone . Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 If it's just about the layout/design, you can copy the files from /pdf into /themes/your_theme/pdf and adjust the correponding tpl files Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Thanks for your response It's not about the design , I want to change what pdf is returned when you click on the link to download the invoice pdf . Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 I'm still not sure what you want to do, but the invoice PDFs are generated in \classes\pdf\HTMLTemplateInvoice.php, you can create an override for this Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 I have generated a pdf through an other service externally I want to use it instead of the one used by prestashop in the Order history page , But I cannot find where the method in charge of the variable order.details.invoice_url (used in history.tpl) is located , I already tried multiple classes (Order,OrderHistory,OrderDetail,OrderInvoice) but none of the methods I commented seems to have an effect on the history page . Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 Assuming you want to change the link here In PS8 you need to extend the corresponding twig file src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\documents.html.twig. But please note there are more links to the invoice e.g. in order overview and on top of the order detail page Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 I answered but seem it need approval from mod, trying this way Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Thanks again , I am sorry I didn't make my self clear 😕 , I want to change the pdf distributed when I click to the pdf button , But I don't know where the method could be to change that Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 Yes, simplest way it to change the link here and reference to the file on external service (or to a copy on the PS server). Screen looks like an old PS version, so it will be in some tpl file - if you don't see changes in tpl clear the PS cache. Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Sorry I'm using prestashop 1.7.8.9 where does this menu is ? Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 Please ignore my screenshot, thats PS8 backoffice. I understand you want to change it in frontoffice (customer order history) - in classic theme it would be file themes\classic\templates\customer\history.tpl Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Thanks again for your patience , I did know how to change the link in the template but I wanna know where the link is crafted in wich class or controller because I need to overide it Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 sadly I did already find this , but if I comment the method I still get the urls in the history page 😕 Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 and I cleaned the cache after commenting the method Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 You should get a fatal error if you comment this method, maybe you have an override active (which you should use anyway instead of changing core controller directly)? Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 My plan was to use an override but I wanted to be sure that it was the correct method used to do this , How did you manage to get this error ? the only thing I managed to do is to comment the whole class and get a 500 error , but nothing more , I have one override and this is an Product override that is empty Link to comment Share on other sites More sharing options...
JBW Posted February 8 Share Posted February 8 For testing directly in HistoryController 1 Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 8 Author Share Posted February 8 Thank you for your responses it seems that it was my docker container that led me into thinking it was not the right method , but it was ! Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 12 Author Share Posted February 12 I don't know why but when I overload the method it gives me an error 500 Link to comment Share on other sites More sharing options...
JBW Posted February 13 Share Posted February 13 What are the error details? Link to comment Share on other sites More sharing options...
ElFamosoWilli Posted February 13 Author Share Posted February 13 Thanks for your response I found out what whas causing the issue everything works perfectly now ! thanks 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