I've been trying to change some texts in the invoice PDF create at order confirmation, I need to change the text : Order #xxxxxxxx. Where can I change this ?

I've tried in :


Nothing worked.

I can't find where this PDF is created, I really need some help.

Thank you.


You'll need to rewrite the Mage_Sales_Model_Order_Pdf_Invoice class from a module. Specifically the insertOrder method located in the parent Mage_Sales_Model_Order_Pdf_Abstract class.

It's a pretty big method to overwrite, specially for something cosmetic. Optionally see if you can change the Order # string in the app/locale/[language]/Mage_Sales.csv to fit your needs.

But, if you do want to rewrite the new class would look something like this

class MageSE_Rewritepdf_Model_Sales_Order_Pdf_Invoice extends Mage_Sales_Model_Order_Pdf_Invoice

     * Insert order to pdf page
     * @param Zend_Pdf_Page $page
     * @param Mage_Sales_Model_Order $obj
     * @param bool $putOrderId
    protected function insertOrder(&$page, $obj, $putOrderId = true)
        if ($obj instanceof Mage_Sales_Model_Order) {
            $shipment = null;
            $order = $obj;
        } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
            $shipment = $obj;
            $order = $shipment->getOrder();

        $this->y = $this->y ? $this->y : 815;
        $top = $this->y;

        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
        $page->drawRectangle(25, $top, 570, $top - 55);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
        $this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
        $this->_setFontRegular($page, 10);

        if ($putOrderId) {
                Mage::helper('sales')->__('Order # ') . $order->getRealOrderId(), 35, ($top -= 30), 'UTF-8'

        // and the rest of the method

and the modules config.xml like this

<?xml version="1.0"?>
| improve this answer | |

The PDF's are not generated via templates.
You should look in the app/code/core/Mage/Sales/Order/Pdf folder. You should get an idea on which class serves each PDF by their names.

| improve this answer | |

Ok As far as I can see I can edit the PDF here :


But I have a module who change this default template, if I desactivate the module it works fine.

I'm gonna look into this module deeper but I think this is another problem.

EDIT : The module is Aitoc Checkout Fields Manager. In fact it create a copy of this file in var/ait_patch and that template is used.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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