Book Image

Getting Started with Magento Extension Development

By : Branko Ajzele
Book Image

Getting Started with Magento Extension Development

By: Branko Ajzele

Overview of this book

Modules, are a group of php and xml files meant to extend the system with new functionality, or override core system behavior. Most of the base Magento system is built using the module system, so you can see why they are an important feature for this rich open-source e-commerce solutions. This book explores key module development techniques and teaches you to modify, understand and structure your modules making it easy for you to get a strong foundation for clean and unobtrusive Magento module development. Getting Started with Magento Extension Development is a practical, hands-on guide to building Magento modules from scratch. This book provides an in depth introduction and helps you discover features such as; blocks, controllers, models, configuration files, and other crucial elements which contribute to the Magento architecture. This book introduces the you to real-world modules and helps provide a strong foundation which you need to become a professional Magento module developer. The book further explores best practices and tips and tricks offering you the ultimate go to guide. Getting Started with Magento Extension Development focuses on three areas. First you are guided through the entire Magento structure, where each important directory or file is explored in detail. Then the essence of the module structure and development is explained through the detailed coverage of models, blocks, controllers, configuration, and other files that manifest a single module. Finally, a detailed set of instructions is given for building four real-world modules, including a payment and shipping module.
Table of Contents (13 chapters)
Getting Started with Magento Extension Development
About the Author
About the Reviewers


There is one part of Magento functionality that gets equally used across all the individual functionality mentioned so far, and that's helpers. Magento helper is a class that usually extends the Mage_Core_Helper_Data class directly found in the app/code/core/Mage/Core/Helper/Data.php file or at the very least derived from the Mage_Core_Helper_Abstract class found under the app/code/core/Mage/Core/Helper/Abstract.php file.

The Helper classes contain various utility methods that will allow you to perform common tasks on different objects and variables. Helpers too are defined via the config.xml elements as follows:

<?xml version="1.0"?>
   <!-- … other elements ... -->
   <!-- … other elements ... -->

Similar to blocks and models, helpers have a class element defined to point to their folder locations within an extension. In this example, a helper is defined with the name foggyline_happyhour.

As you are allowed to have multiple helpers under the app/code/community/Foggyline/HappyHour/Helper/ folder, it is important to know that the default helper PHP filename is Data.php.

What this really means is that when you execute a statement such as Mage::helper('foggyline_happyhour');, Magento will load the Data.php helper. If, however, you execute a statement such as Mage::helper('foggyline_happyhour/image');, Magento will load the Image.php helper (the app/code/community/Foggyline/HappyHour/Helper/Image.php file).