I am trying to rewrite the model sales_order_credit_memo_api with my own "info" function. I have created all the files yet when I access the API call "order_creditmemo.info" it uses the base Mage model, instead of using the class defined in my rewrite.
I have successfully rewritten other models, but I cannot get this one to work. Does anyone know what I'm doing wrong?
With all the coding shown below in place if I use the magerun.phar tool and run this command magerun.phar dev:class:lookup model sales/order_creditmemo_api
it results in Model sales/order_creditmemo_api resolves to Kane_MultiDiscountAPI_Model_Order_Creditmemo_Api
which should mean everything is working.
The file that contains the class I'm trying to rewrite is: app/code/Mage/Sales/Model/Order/Creditmemo/Api.php
FILES IN MY EXTENSION:
app/etc/modules/Kane_MultiDiscountAPI.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Kane_MultiDiscountAPI>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Sales />
</depends>
</Kane_MultiDiscountAPI>
</modules>
</config>
app/code/local/Kane/MultiDiscountAPI/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Kane_MultiDiscountAPI>
<version>0.1.0</version>
</Kane_MultiDiscountAPI>
</modules>
<global>
<models>
<sales>
<rewrite>
<order_api>Kane_MultiDiscountAPI_Model_Order_Api</order_api>
<order_creditmemo_api>Kane_MultiDiscountAPI_Model_Order_Creditmemo_Api</order_creditmemo_api>
</rewrite>
</sales>
</models>
</global>
</config>
app/code/local/Kane/MultiDiscountAPI/Model/Order/Creditmemo/Api.php
class Kane_MultiDiscountAPI_Model_Order_Creditmemo_Api extends Mage_Sales_Model_Order_Creditmemo_Api
{
public function info($creditmemoIncrementId)
{
$result = parent::info($creditmemoIncrementId);
// Extended logic
return $result;
}
}
app/etc/modules
(Kane_MultiDiscountAPI.xml
) and set it todepend
onMage_Sales
?