There is a sendEmail function inside the Invoice.php class at app\code\core\Mage\Sales\Model\Order\Invoice.php that I wanted to change hence I thought I should extend the class and make my changes in the local module.
I started off by making a directory on the server called
/public_html/app/code/local/Mymodule
Then I added the config.xml as follows:-
/public_html/app/code/local/Mymodule/Sales/etc which has the following config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mymodule_Sales>
<version>0.1</version>
</Mymodule_Sales>
</modules>
<global>
<models>
<sales>
<rewrite>
<order_invoice>Mymodule_Sales_Model_Order_Invoice</order_invoice>
</rewrite>
</sales>
</models>
</global>
</config>
I then created another folder as follows
/public_html/app/code/local/Mymodule/Sales/Model
which houses Invoice.php
<?php
class Mymodule_Sales_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoice
{
/**
* Send email with invoice data
*
* @param boolean $notifyCustomer
* @param string $comment
* @return Mage_Sales_Model_Order_Invoice
*/
public function sendEmail($notifyCustomer = true, $comment = '')
{
I have disabled the original function in the original class and when I try to send an email it gives me an error.
What am I doing wrong?