I'm trying to extend the Customer module in Magento but I'm not having much luck.
I have: added a MyModule_Customer.xml to the etc/modules directory, set up with correct name and path. Created a MyModule/Customer/etc/config.xml Created a MyModule/Customer/Model/Customer.php (copied from Core/Customer). I added a Mage::log to my new class but it never logs anything.
There are to things I'm not sure about. Does my Customer.php class declaration extend the Mage_Customer_Model_Customer class or the Mage_Core_Model_Abstract class. What I've read online isn't consistent.
Is this the correct format for the rewrite section in the MyModule/etc/config.xml? MyModule_Customer_Model_Customer .... Or should there be another element inside the ? I tried adding around the path but that stopped Magento working altogether.
EDIT: The local/MyModule/Customer/etc/config.xml This is really a copy of the Mage/Customer config.xml with the module redefined and the rewrite section added
<pre>
global>
models>
customer>
rewrite>
customer>
MyModule_Customer_Model_Customer
/customer>
/rewrite>
/customer>
/models>
/global>
</pre>
But this caused Magento to break and not display anything. My current best guess is as above but with the most inner customer elements removed.
EDIT 2: Here is all the code The app/etc/modules/MyModule_Customer.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyModule_Customer>
<active>true</active>
<codePool>local</codePool>
<depends>
Mage_Customer
</depends>
</MyModule_Customer>
</modules>
</config>
A query about this format - most articles I saw didn't have a depends element here but enough did that I though I should try it, it makes sense. But is it right?
My local/MyModule/Customer/Model/Customer.php declaration:
class MyModule_Customer_Model_Customer extends Mage_Customer_Model_Customer
So, thats everything. The tutorials I read online suggest this should be trivial so what am I doing wrong? Any help would be much appreciated. Thank you.
<global> <models> <customer> <rewrite> <customer>MyModule_Customer_Model_Customer</customer> </rewrite> </customer> </models> </global>
– Aleksandr