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


Building Magento extensions can be a challenging task for several reasons. On one side a developer is required to have a solid understanding of advanced PHP object-oriented knowledge, while on the other side there are numerous Magento-specific patterns and configuration options you need to master. This book will give you enough insight into the structure and concepts, and teach you a few tricks that will help you master Magento more easily. By the end of the book, you should familiarize yourself with configuration files, models, blocks, controllers, event/observers, shipping, and payment methods. All of these should form a solid foundation for your developing modules later.

What this book covers

Chapter 1, An Overview of Magento Extensions, introduces you to the overall Magento directory structure, digging all the way down to the individual module structure. Important concepts such as Block, Model, Helper, and controller classes together with configuration files are introduced and explained.

Chapter 2, Building the Extension – Maximum Order Amount, guides you through your first real-world module. Using the event/observer system, you build a simple but powerful module for limiting the amount of maximum purchase.

Chapter 3, Building the Extension – Logger, introduces you to the practical usage of models and installation scripts in Magento, together with the use of administration grids for displaying the entity data.

Chapter 4, Building the Extension – Shipping, introduces you to the Magento shipping methods system, showing you a practical example for building your own shipping method.

Chapter 5, Building the Extension – Payment, introduces you to the Magento payment methods system, showing you a practical example for building your own payment method.

Chapter 6, Packaging and Publishing Your Extension, introduces you to the process of packaging your extension for distribution over the Magento Connect extension marketplace.

What you need for this book

In order to successfully run all the examples provided in this book, you will need either your own web server or third-party web hosting solution. The Magento Community Edition platform itself comes with a detailed list of system requirements, which you can find at If you are able to install Magento on your server, you should be able to follow all the guidelines given in the book.

Who this book is for

This book is primarily intended for intermediate to advanced PHP developers looking for a way into Magento module development. The existing Magento developers might find certain chapters interesting as well, depending on their previous experience.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "This is basically a .htaccess template file used for creating new stores within subfolders."

A block of code is set as follows:

<?xml version="1.0"?>

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "You can confirm that by going under the Magento administration under System | Configuration | Advanced | Advanced | Disable Modules Output."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.