I have stuck with this. I am trying to override sales/ order model _saveafter function with my custom module. I have the following code
\app\code\local\Rkt\SalesNew\etc\config.xml
<modules>
<Rkt_SalesNew>
<version>0.0.1</version>
</Rkt_SalesNew>
</modules>
<global>
<models>
<salesnew>
<rewrite>
<method>Rkt_SalesNew_Model_Order</method>
</rewrite>
</salesnew>
</models>
</global>
\app\code\local\Rkt\SalesNew\Model\Order.php
class Rkt_SalesNew_Model_Order extends Mage_Sales_Model_Abstract
{
protected function _afterSave()
{
if (null !== $this->_addresses) {
$this->_addresses->save();
$billingAddress = $this->getBillingAddress();
$attributesForSave = array();
if ($billingAddress && $this->getBillingAddressId() != $billingAddress->getId()) {
$this->setBillingAddressId($billingAddress->getId());
$attributesForSave[] = 'billing_address_id';
}
$shippingAddress = $this->getShippingAddress();
if ($shippingAddress && $this->getShippigAddressId() != $shippingAddress->getId()) {
$this->setShippingAddressId($shippingAddress->getId());
$attributesForSave[] = 'shipping_address_id';
}
if (!empty($attributesForSave)) {
$this->_getResource()->saveAttribute($this, $attributesForSave);
}
}
if (null !== $this->_items) {
$this->_items->save();
}
if (null !== $this->_payments) {
$this->_payments->save();
}
if (null !== $this->_statusHistory) {
$this->_statusHistory->save();
}
foreach ($this->getRelatedObjects() as $object) {
$object->save();
}
return parent::_afterSave();
}
}
I am unable to override this function. Can any one please help me out.