2

Can anybody tell me where I can change the title of the invoice pdf. At the moment it states invoice(date and time). I want to change it to Invoice(invoicenumber)I work with magento 1.9.1.

2 Answers 2

1

Vinothavn, thnx for your answer. I looked into the coding and tried it, but unfortulnately it didnt work. But I altered some other code in the same file and that did work. I changed this:

$this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
                '.pdf', $pdf->render(), 'application/pdf');

Into this:

$this->_prepareDownloadResponse('Factuur_'. $invoice->getIncrementId().
                '.pdf', $pdf->render(), 'application/pdf')

And now the pdf exports with the invoicenumber.

0

The file which has the invoice tile is in below path

app\code\core\Mage\Adminhtml\Controller\Sales\Invoice.php

   public function pdfinvoicesAction(){
    $invoicesIds = $this->getRequest()->getPost('invoice_ids');
    if (!empty($invoicesIds)) {
        $invoices = Mage::getResourceModel('sales/order_invoice_collection')
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('entity_id', array('in' => $invoicesIds))
            ->load();
        if (!isset($pdf)){
            $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
        } else {
            $pages = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
            $pdf->pages = array_merge ($pdf->pages, $pages->pages);
        }

        return $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
            '.pdf', $pdf->render(), 'application/pdf');
    }
    $this->_redirect('*/*/');
}

You can change

  return $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
            '.pdf', $pdf->render(), 'application/pdf');

to

return $this->_prepareDownloadResponse('invoice'.$invoicesIds.
            '.pdf', $pdf->render(), 'application/pdf');
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.