Create a simple model class in Magento

Assume we have a Helloworld module under MyExtensions package, and we want to create a simple model class and a hello function in this model to print hello world.
1. Add the below in the global tag in Magehome/app/code/local/MyExtensions/etc/config.xml


2. Create a file at Magehome/app/code/local/MyExtensions/Model/Utilities/Hello.php

class MyExtensions_Helloworld_Model_Utilities_Hello
	public function hello()
		echo "Hello World!!!";

3. Now we can call this hello function anywhere in Magento like this:


Search within Codexpedia

Custom Search

Search the entire web

Custom Search