Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:58+00:00 2026-06-13T23:10:58+00:00

I tried to override Pdf classes for making changes toInvoice/Shipment/Creditmemo pdf but it doesnt

  • 0

I tried to override Pdf classes for making changes toInvoice/Shipment/Creditmemo pdf but it doesnt seem to reflect.

I created a module with following in the Mymodule/etc/config.xml

<config>
<modules>
    <Mymodule_Printtemplates>
        <version>0.1.0</version>
    </Mymodule_Printtemplates>
</modules>
<global>
    <models>
        <sales>
            <rewrite>
                <order_pdf_abstract>Mymodule_Printtemplates_Model_Order_Pdf_Abstract</order_pdf_abstract>
                <order_pdf_invoice>Mymodule_Printtemplates_Model_Order_Pdf_Invoice</order_pdf_invoice>
                <order_pdf_creditmemo>Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo</order_pdf_Creditmemo>
                <order_pdf_shipment>Mymodule_Printtemplates_Model_Order_Pdf_Shipment</order_pdf_shipment>
            </rewrite>
        </sales>
    </models>
</global>

Then I created following Model classes in Mymodule/models/
as Abstract.php, Invoice.php, Shipment.php, Creditmemo.php

abstract class Mymodule_Printtemplates_Model_Order_Pdf_Abstract extends Mage_Sales_Model_Order_Pdf_Abstract

class  Mymodule_Printtemplates_Model_Order_Pdf_Invoice extends  Mymodule__Printtemplates_Model_Order_Pdf_Abstract { ... functions here ...}

class Mymodule_Printtemplates_Model_Order_Pdf_Shipment extends Mymodule__Printtemplates_Model_Order_Pdf_Abstract{ ... functions here ...}

class Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo  extends  Mymodule__Printtemplates_Model_Order_Pdf_Abstract{ ... functions here ...}

The module is enabled – I have checked it through System>Configuration>Admin>Advanced but it doesn’t seem to reflect the changes

On the other-hand, if I copy paste Mage/Sales/Model/Order/Pdf/*.php into local and change, changes are reflected. I know this is not a recommended method but the method via rewriting classes doesnt seem to work.

Any help for the first method via class rewrite would be appreciated.

Thanks,
Loveleen


The real problem was a Syntax in error in etc/config.xml [see Capital C in ending tag]

Mymodule_Printtemplates_Model_Order_Pdf_Creditmemo

I used the following to debug the issue: Drop this in the bottom of your index.php, similar to Alans Module List but a quick code copy/paste approach. Remember all of Magento’s XML’s get combined into one XML tree.

header(“Content-Type: text/xml”); die(Mage::app()->getConfig()->getNode()->asXML());

Taken from the answers of: How do I know whether my Config.xml file is working in Magento?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:10:59+00:00Added an answer on June 13, 2026 at 11:10 pm

    Here are a couple of things that I am seeing.

    1. What are the file paths to each of your overridden files? They should be: Mymodule/Printtemplates/Model/Order/Pdf/Invoice.php, for example. The class name should match the file name.
    2. Rewrites do not affect abstract classes, unless the abstract class is called with a factory method (not recommended). The way that a rewrite works is through the factory methods (Mage::getModel('')). Using the factory method allows Magento to look through the system to see if another class is needing to be used. However, when a class is hard-referenced (e.x. Mage_Sales_Model_Order_Pdf_Abstract), it does not go through the factory method, and thus no rewrites will occur on that.
    3. I would consider making each of your classes extend their original class (e.x. Mage_Sales_Model_Order_Pdf_Invoice, etc). If you have extra common functions, you would possibly put those into a Helper.
    4. To see if the code is even being called, put a known code error in the file. PHP will complain, and that tells you that your file is being loaded.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an OnPaint event of my button,which I lately tried to override,but I
I tried to override the second tableHeaderView. But it seems that the height of
I tried following the answer here how to override a task making it depend
I tried to override the dynamic method addTo* provided by Grails/GORM but it doesn't
I first tried to override the delete() method but that doesn't work for QuerySet's
I tried some variants, one of them: tv.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence
I don't know why , i can't override back button: I tried everything I
tried uncommenting pam_limits.so from the pam.d directory but no luck. Basic PAM seems to
Tried searching the site, but cannot find an answer to my problem: Lets say
I have subclassed UIImageView and tried to override drawRect so I could draw on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.