Magento Forum

   
Get a custom module to work? 
 
kharisma
Member
 
Total Posts:  67
Joined:  2007-10-18
Australia
 

I have experimented first by copying the app/code/core/Mage/Core/Model/Message folder to app/code/local/Mage/Core/Model/Message then set Abstract::getText() to add a piece of text so I’d know that was the module being executed.

I called it by adding this code to the page template <?=Mage::getSingleton('core/message')->success('message')->getText()?> That works OK.

Then I copied that folder to app/code/core/Mage/Custom/Model/Message and set getText() to add different text.

I also changed the class names to Mage_Custom_Model_...

In app/etc/modules/Mage_All.xml I also added
<Mage_Custom>
<active>true</active>
<codePool>core</codePool>
</Mage_Custom>

This does not work, so I created app/code/core/Mage/Custom/etc/config.xml using this code:
<?xml version="1.0"?>
<config>
<modules>
<Mage_Custom>
<version>0.1.0</version>
</Mage_Custom>
</modules>
<global>
<models>
<custom>
<class>Mage_Custom_Model</class>
</custom>
</models>
</global>
</config>

However, this produces an Internal Server Error.

I have read through http://www.magentocommerce.com/wiki/how-to/create-payment-method-module and cannot see what else I can change or create.

What do I need to do differently to make the Custom module work?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SeL_
Magento Team
 
Avatar
Total Posts:  1140
Joined:  2007-10-10
Paris, France
 
kharisma - 18 January 2008 02:55 AM

In app/etc/modules/Mage_All.xml I also added
<Mage_Custom>
<active>true</active>
<codePool>core</codePool>
</Mage_Custom>

Try this:

<codePool>local</codePool>

Tell me if this helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
kharisma
Member
 
Total Posts:  67
Joined:  2007-10-18
Australia
 

Thanks, I had put Mage_Custom into the core code to start with.

Anyhow, I put a copy into /local/ as well, with appropriate updates (changing class names, Mage_All.xml to <codePool>local</codePool>, etc) still same deal - Internal Server Error

(I am basically starting with code that obviously works in the main app, and copying that into local, check if that works, make another change, test, until I can make my own module work.)

 
Magento Community Magento Community
Magento Community
Magento Community
 
kharisma
Member
 
Total Posts:  67
Joined:  2007-10-18
Australia
 

Well, I started again with a fresh install and whatever I did wrong the first time is now sorted. smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top