Free custom magento module to add captcha to your magento store.Which will protect magento sites from spam posts.Below is brief description about writing/creating a custom
magento module based on this custom module.Those who want to customize this magento module will find this helpfull.I also hope this will be a good guide for anyone who are in magento development looking for any kind of magento customization
For getting extension key or to see screenshots visit magento connect page of this custom magento extension
The old page in magento connect is
but it doesnt show the latest version.
So check the new magento connect page of this module
Creation of OutsourceOnline Captcha for magento/Writing a custom module for magento/Magento Customization basics/Using AJAX in a magento module/MVC in magento
Please install the module from magento connect before proceeding further.Please refer the following links and come back so that you can have a clear idea regarding the basics of module creation and AJAX integration in magento(if you haven't t done this before)
I am not explaing the inner contents of each files since you will have the files added to your magento .Please note the naming conventions for each class and config nodes.By naming conventions I mean the usage of uppercase and lower case letters and underscores(_).For example a class name must contain the name of each folder in the path of that class from app/code/community folder,names of folders will be with first letter uppercase and remaining letters in lowercase.Each name should be sperated with an underscore. Custom modules will not work properly in magento without following naming conventions properly
Let us now go through the files that constitutes this custom extension
app/etc/modules/OutsourceOnline_Captcha.xml - lets magento know that the new module is in app/code community folder
-------config.xml - mentions the frontend,routing,model ,view,controller,template and layout files,translater file and admin default values
-------system.xml - admin configuration fields,field sources
app/design/frontend/default/default/layout/OutsourceOnline_Captcha.xml - explains the template parts that will be used by this module
app/locale/en_US/OutsourceOnline_Captcha.csv - File you could edit the texts(labels and error message related to this module)
if you are using a different language you need to save a copy of this file to your language's folder(for eg:es_ES/OutsourceOnline_Captcha.csv if you are using spanish) after setting appropriate texts in the second colomn of each line;
Config File : Let magento know that the new module is added.This will become part of global config file which magento uses to render any page
Magento works on MVC(model vew and controller) structure.So any custom module should have seperate classes to handle the role of model ,view and controller.
There are naming conventions and there are file locations for creating each files that represent MVC(model vew and controller) .In addtion to that there should be a config file(mandatory) and a system file(only if the module have any admin options)
Both files are located in app/code/community/OutsourceOnline/Captcha/etc
So now comes the steps to creating actual files that give life to the MVC(model vew and controller)structure of the module.
Model:Model is that part which mainly handles the database part.So when you have to perfrom some database related operations ,you assignthe task to thios class.We dont have any complex operations but we still used 2 model classes to act as source for magento config options.Magento is apprised about this through config.xml
View:View is that part of a module which handle the display part.View role in magento will be handled by a block class as well as a phtml file.When you want to use a view you need to let magento know about how,when and where to show the view.For that you need to use the layout file.
Layout file is therefore a config file for view.Layout file of the magento captcha extension is
Once the layout is added you need to add the phtml and block files.block file contains the php class that handles the view and phtml files contain the html part.phtml files will be included in the block classes and will be using the variables and methods as part of the block class.
phtml files of this plugin is at
Important point when you use a a custom magento theme
When you use a a custom magento theme(instead of the default magento theme),you need to edit the phtml files the concerned forms(registration,contact us,send a friend,review) of this extension to match the other forms and pages of that custom magento theme .This because the forms are over ridden by this custom magento extension.Tou need to edit the css of these phtml files even if you chose not to use captcha image and avail only botscout protection.The list of phtml files to edit are 'contacts.phtml'(Contact Us form),'register.phtml('Registration form),'form.phtml'(product review form),'send.phtml'(Send a friend form)
and the block files are at
Since we are only subclassing existing block classes only one class is added.
Controller:As the name implies ,this control classes controlls the entire functionalities associated with the module.Magento is apprised about this through config.xml
This was a starting point for me for implementing the AJAX functionality for security code checking of this plugin
there are several xml files that together constitute the magento config
A good article for viewing the entire magento configuration is at
A few other good articles about customizing magento are
For identifying layout and template files
Manually Uninstalling this Magento module(not recommended.Do this only if you are unable to unistall through magento connect)