-1

I have been trying to find the file where the pdf invoice is generated to change the name of it, to the name of the user, e.g instead "invoice00012", I would like to have "John Smith.pdf". I would appreciate your help. Thanks.

Roman K.
  • 945
  • 1
  • 9
  • 17
Khan209
  • 3
  • 2

1 Answers1

0

Modify function getFilename() in classes/pdf/HTMLTemplateInvoice.php. You get the customer object using $customer = new Customer((int)$this->order->id_customer);.

public function getFilename()
{   
    $customer = new Customer((int)$this->order->id_customer);

    return $customer->firstname.'_'.$customer->lastname.'.pdf';     
}
Roman K.
  • 945
  • 1
  • 9
  • 17
  • thanks, but I couldn't get the username in the getFilename(), I tried this "$this->context->customer" – Khan209 May 23 '18 at 14:14