0

Hi guys I have a plugin that I need to amend!

The file I need to change is: /app/code/local/Magestore/Pdfinvoiceplus/Model/Sales/Order/Invoice.php

Here are my plugin files:

/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_InvoiceEmail>
            <version>0.0.1</version>
        </Company_InvoiceEmail>
    </modules>
    <global>
        <models>
            <invoiceemail>
                <class>Company_InvoiceEmail_Model</class>
            </invoiceemail>
            <magestore_pdfinvoiceplus>
                <rewrite>
                     <sales_order_invoice>Company_InvoiceEmail_Model_Sales_Order_Invoice</sales_order_invoice>
                 </rewrite>
             </magestore_pdfinvoiceplus>
        </models>
    </global>
</config>

/app/code/local/Company/InvoiceEmail/Model/Sales/Order/Invoice.php

class Company_InvoiceEmail_Model_Sales_Order_Invoice extends Magestore_Pdfinvoiceplus_Model_Sales_Order_Invoice
{
...
}

Can someone point me in the right direction as to why my module isn't overriding this class?

Thanks!

EDIT Original plugin snippet:

<global>
        <models>
            <pdfinvoiceplus>
                <class>Magestore_Pdfinvoiceplus_Model</class>
                <resourceModel>pdfinvoiceplus_mysql4</resourceModel>
            </pdfinvoiceplus>
            <sales>
                <rewrite>
                    <order>Magestore_Pdfinvoiceplus_Model_Sales_Order</order>
                    <order_invoice>Magestore_Pdfinvoiceplus_Model_Sales_Order_Invoice</order_invoice>
                    <order_creditmemo>Magestore_Pdfinvoiceplus_Model_Sales_Order_Creditmemo</order_creditmemo>
                </rewrite>
            </sales>
        </models>
</global>
10
  • Did you add the dependency to the module you're overriding in your module's setting XML? (app/etc/modules/Company_InvoiceEmail.xml)
    – Alex Dinca
    Commented May 19, 2017 at 9:14
  • add /app/code/local/Magestore/Pdfinvoiceplus/etc/confix.xml code Commented May 19, 2017 at 9:15
  • @AlexDinca I didn't, what should I be adding exactly? Commented May 19, 2017 at 9:20
  • @KiwisTasteGood check updated answer Commented May 19, 2017 at 9:26
  • @KiwisTasteGood how is the model prefix defined in the Magestore Pdfinvoiceplus XML? Can you please paste it (app/code/community/Magestore/Pdfinvoiceplus/etc/config.xml)?
    – Alex Dinca
    Commented May 19, 2017 at 9:39

1 Answer 1

1

AFAIK You have to write below way to rewrite this module

<?xml version="1.0"?>
<config>
<modules>
    <Company_InvoiceEmail>
        <version>0.0.1</version>
    </Company_InvoiceEmail>
</modules>
<global>
    <models>
        <invoiceemail>
            <class>Company_InvoiceEmail_Model</class>
        </invoiceemail>
        <pdfinvoiceplus><!--Change this node-->
            <rewrite>
                 <sales_order_invoice>Company_InvoiceEmail_Model_Sales_Order_Invoice</sales_order_invoice>
             </rewrite>
         </pdfinvoiceplus>
    </models>
</global>
</config>

create a new file in etc\modules file name would be Company_InvoiceEmail.xml

<config>
    <modules>
        <Company_InvoiceEmail>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Magestore_Pdfinvoiceplus/>
            </depends>
        </Company_InvoiceEmail>
    </modules>
</config>
1
  • Unfortunately this didn't work Commented May 19, 2017 at 9:22

Your Answer

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

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