What is a Magento module?
A Module is a type of Magento extension that extends the features and functionality of Magento.
They follow strict terms and conditions prohibiting developers from modifying the Magento core code which would have a negative impact on upgrading the system whenever a new Magento version is released.
Modules can extend any area of Magento eCommerce Store, they’re not limited in functionality and can be used for simpler things like enhancing the look and feel of the store, product display and description, rollovers, etc. or more complex elements like extending the business logic behind the store, checkout process, integration of additional payment gateways, promotional items, cross sells, etc.
Magento extensions are classified in several categories:
- Magento Core extensions created by MagentoCommerce team
- Community extensions build by Magento Community and are distributed for free
- Commercial extensions which are paid Magento extensions
Why use modules?
Magento is a modular system, it includes and uses modules which can be as simple as a static block or as complex as interacting with other modules or 3rd party systems.
The advantage of using modules in a Magento framework is to achieve independence of functions, reusability and flexibility.
How do you install extensions?
Installation of Magento extensions is simple, but installation instructions should be followed when using free community distributed editions, or if it’s a commercial extension.
Community extensions are installed using Magento Connect which is an extensions downloading mechanism offered at: http://www.magentocommerce.com/magento-connect.
Using the extension key provided on the module description page, it can be installed from the admin area of the personal Magento store. Usually after the installation process the extension should be ready to use, unless there are mode configuration settings to be made which are specified in the documentation.
Magento Commercial extensions are not sold through Magento Connect and usually must be purchased from the merchant’s site. After successful purchase, the extension is delivered in a zip file containing the source code and installation instructions.
All the extensions are written by different companies or individuals and installation instructions differ from each other. Either way, one key step after extension installation (no matter if it’s free or commercial) is to refresh Magento Cache in Admin Area > System > Cache Management.
How to develop your own?
Developing your own Magento module means to create custom modules, which is part of the Magento customization process. Custom created modules allow its user to inject functionality anywhere in the Magento system.
Magento custom modules can do a variety of things: from editing the database, to handling module upgrades to overriding classes (Blocks, Controllers, Models), and more.
Creating custom modules can be done in a variety of ways, the most important thing to keep in mind is that a module should not change the core code, it should only extend its functionality.
General steps to take when creating a custom module:
- Create Directories
- Activate Module
- Create Controller
- Create Configuration XML
- Create Helper
- Create Models
- SQL Setup
- Template Design
A complete tutorial with code examples and full explanations can be found here:
Case study: Harbor Freight Tools Magento Store Custom Modules
Based on the Magento Enterprise eCommerce solution, we developed several custom modules in order to satisfy the requirements and integration with other existing legacy systems.
Custom modules included:
- HFTPayment: extends core payment module, customized to follow HFT payment guidelines and data encoding, everything being fully PCI compliant.
- HFTExport: extends core checkout process, customized to export cart data for integration with a different system
- HFTTrack: custom module for tracking shipped orders
- HFTImport: custom module to update orders placed thru the store with up to date information such are shipping status, tracking, etc
- CouponCapture: custom module to handle product coupons on store frontend
- QuickCart: custom module to display an AJAX based cart through the Magento store
NOTE: read the full case study on Harbor Freight here.