Jump to content

I would like to change the file name of pdf invoices in PS 1.6.0.11


Recommended Posts

Hi, I'm using PS 1.6.0.11 and would like to change the name of the generated pdf file when printing invoices.

 

In PS standard version, if I have the order #3567 with invoice #1578 and print the invoice, PS generates a pdf file with this name: 1578.pdf

 

My idea is to get as file name (<invoice number> - <order number>.pdf, in above example would be: 1578-3567.pdf

 

Does anyone know how to make these changes ?.

 

Thanks and regards

Link to comment
Share on other sites

You need to either create an override of the HTMLTemplateInvoice class, or just edit the HTMLTemplateInvoice class directly.

 

The HTMLTemplateInvoice class has a function "getFilename".  Either override this function to provide your filename logic, or just edit the core class to apply your logic

public function getFilename()
{
    return Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order_invoice->number).'.pdf';
}
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...