Magento 1.3: PHP Developer's Guide

By Jamie Huskisson
    Advance your knowledge in tech with a Packt subscription

  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Magento 1.3: PHP Developer's Guide

About this book

Magento is the most powerful e-commerce solution around and has gained popularity in a short period of time. You can create and manage online stores using the extensive suite of powerful tools it offers. However, because of its powerful features, developing with Magento can be easier said than done.

This book will show you how to develop better and do more with the Magento. You will be able to extend and customize modules for the Magento system without editing the core system code. It will show you how to create both basic and advanced functionality modules for your store and help you turn your ideas for extending Magento into reality by building modules from scratch.

This book starts by walking you through the server requirements for installing Magento making sure Magneto's installation and upgrade process can fit into your workflow and suit your hosting environment setup. Then it runs through the architecture behind Magento's system, covering the core file structure and how the template system works. You'll also learn how to build a basic shipping module, payment module, and a brand management module for Magento. As you delve deeper into the book you will learn how to integrate your favorite CMS into Magento for data portability.

By the end of the book you will be able to take your basic knowledge of Magento and turn it into something advanced that will help you develop turn your ideas for extending Magento into reality.

Publication date:
January 2010


Chapter 1. Magento 1.3: PHP Developer's Guide

After developing a site or two in Magento, we would want to take our development a step ahead. Magento 1.3: PHP Developer's Guide is a book for those developers who want to work with the Magento e-commerce platform. In this book, we will be guided through the fundamentals of development with Magento.

If we're either frustrated with the "give you all the code" tutorials and articles online or actually really prefer them then, we'll find comfort in the code examples given in this book. Each code block in the book is followed by a detailed piece-by-piece explanation of what each part of the code does. This way, we can get information about not just the functionality, but also learn about the inner workings of the code being implemented.

Practical knowledge focused on common requirements of any Magento development is gained in this book, in both the day-to-day environment, as well as casual pick-it-up-when-you-need-it situations. This book will add to our development knowledge, once we go through it thoroughly. We will learn the following:

  • Bettering our standards - We'll begin to understand the standards of Magento development and learn the outline of Magento itself, following through to the core architecture.

  • Providing an extremely solid base for development. - The solid base, built by reading this book and following the practical examples in this book, will enable us to experiment with Magento's functionality and extend it in ways unheard of previously.

  • The ability to solve frequently occurring issues. - The time spent developing with Magento will help us in resolving frequently occurring issues. We'll learn to build payment and shipping modules. We'll also learn how to interact with the Magento Core API and importing/exporting data for our websites.


Extending Magento

In this book, we'll be extending Magento in four core areas throughout. These can be broken down into the following:

  • Extensions of existing functionality with new modules that extend the functionality of Magento beyond the module's capability.

  • Brand new pieces of functionality that will seamlessly integrate with Magento's infrastructure to introduce new features to the overall Magento system, beyond its core base.

  • Payment and Shipping methods which implement either special formulas for processing payment and shipping, or integrate with existing gateways of other providers.

  • Wordpress CMS integration to implement Wordpress data into a Magento store, both through a sidebar display block and a blog using our Magento theme template.

With each of these methods for extending Magento, we'll go through how existing modules within Magento do it and how we can too, building real-world examples as we go along.

Practical examples will be used and explained block by block as we go along. Every piece of code is run through to start, allowing us to skim through the chapters when we need the code in a hurry. It is also then backtracked over to ensure that proper understanding and meaningful explanation is given to every block that is placed into our modules or scripts. This ensures that no function is unknown, once the code it written.

We'll extend Magento throughout this book, without touching any of the core files in the installation. This means that the methods taught in this book and those used throughout this book, will not affect the core installation of Magento. When upgrading, we won't need to worry about module malfunctioning.


Core development functionality coverage

In this book, we will cover several topics that we encounter when programming with Magento. These vary from functionality you will touch upon in every single site you build or maintain that is using Magento to functionality that will be touched upon not quite so much, but is equally as important to be aware of when developing with Magento.

Core principles of development

We'll learn everything from building modules that are not touching upon

Magento's core installation, to the file structure of Magento, to the core principles of development with Magento in this book.

System maintenance

Important factors such as upgrading Magento and installed modules, backing up internal system data, and fixing commonly occurring issues will be covered in this book.

Payment and shipping module development

We'll learn how to build both payment and shipping modules while reading this book. These will expand upon Magento's base and provide additional functionality.

Module development

We will build several modules in this book, from basic modules that bring additional features to Magento, to fully featured extensions that manage data in the backend of Magento, as well as having dynamic frontends and their own dedicated URL structure for display.

Data portability and interaction

Probably the biggest factor in choosing any content management system has to, be whether or not we can get the data in or out of the system. Whether or not it will integrate with our existing systems is also a large concern.

In this book, we'll cover mass importing and updating of data via Excel documents and the built-in Core API. These will allow integration with existing backend or internal systems. We'll also cover how to integrate Magento with third-party content management systems.


Chapter overview

The chapters in this book vary greatly in terms of what they teach, to ensure that as many topics are covered as possible. This ensures that in depth knowledge of development is gained from them.

The following topics on Magento development will be covered:

Installing, upgrading, and preparing for development

We'll start by walking through the server requirements for installing Magento and proceed onto how to check manually and how to check automatically using a prepared script that Magento provides for you to check hosting environments prior to installing Magento on them.

Installing Magento manually will be covered step by step, from downloading Magento to uploading the contents of the zip file to our server and going through the installation right to the end. Upgrading will then be covered to ensure that Magento installations are kept up to date with the latest updates released by Varien.

We'll walk through how to perform both these actions through a Secure Shell connection to be able to use your root server access to speed up the upgrade and installation process as well as automate it. SVN (Subversion) users will be able to keep the installation updated using Magento's repository. Overall, this chapter will make sure Magneto's installation and upgrade process can fit into our workflow and suit our hosting environment setup.

System architecture

In this chapter we'll run through the architecture behind Magento's system, covering the core file structure and through to how the template system works. This will be important to understanding Magento as a whole and placing our files in the right place when beginning development. It will help break down the barriers between approaching Magento for the first time and developing your first project that plague most developers.

We'll learn more about the Zend Framework and how it powers Magento's core architecture. This will be explained for a better understanding of Magento's structure.

We'll also go through the best methods for backing up data within Magento, to make sure you're covered before doing anything drastic with your installation and that any data is safe from loss going forward.

Shipping modules

Every Magento installation uses Shipping modules to give the user the option of how their items are delivered to them once they are paid for. In this chapter, we'll be learning how to build a basic shipping module for Magento that will form a module skeleton of functions which can be used in further development of shipping modules. We'll go through what other shipping modules have done and what's possible when building shipping modules for Magento.

Proceeding from there, we'll build a basic shipping module with a few methods applied to it, which will put what we've learned into practice.

Payment modules

Payment modules are vital in Magento, and we'll walk through how to build a basic skeleton of a payment module, in the payment module chapter. From this, we'll learn how they are structured and how to build the base before advancing ahead to something better.

We'll learn how to add basic events to our payment module to advance it towards a fuller integration than expected from a basic module.

Basic module creation and implementation

We'll learn the basics of module creation to build a simple featured-products module implementation which features products on a per category basis. This will outline the principles of structure and implementation of a basic module development useful for further development.

In addition to this, we'll run through some quick tips that will help with Magento development. We'll try to resolve a few common issues that arise during development.

Fully-featured module development with administration panels

With this chapter, we'll be delving deeper into Magento by building a basic brand management module. This will manage brands and display their details, which will be output in a dynamic template that has its own dynamic URL.

This chapter will show the implementation and functioning of the administration section inside Magento, which allows management of our module from the backend. We'll then use this module and its backend for getting a dedicated URL on the frontend and a dynamic output for the managed data.

We'll also go through using the Module Creator script, put together by <credit> to speed up our module creation process in the future. This will cover the base installation of the Module Creator script and how to put it to use.

Integration of third-party CMS

In this chapter, we'll be covering third-party CMS integration, the possibilities and the helping aids in integrating our favourite CMS into Magento for data portability. We'll use Wordpress as a core example and implement Wordpress into Magento using a popular extension.

We'll also walk through other options available for implementation with other CMS. These CMS include Drupal, Typo3, Expression Engine, and Joomla!; the overview and options available for each are described in the chapter.

Magento's core API

Every installation of Magento comes with an available data API for external scripts and internal scripts to interact with the Magento installation's data. We'll walk through how it can be used, setting up the API within an installation, and handling error feedback when it occurs during usage.

We'll learn about the available methods which the API offers and see examples of what can be done with basic outlay of what comes with a default Magento installation. Along with this, there will be practical examples of how to put the API to use with these calls to produce something viable (such as a script) to be used in the future.

Importing and exporting data

Managing data is an import aspect of Magento, and in this chapter we'll be discussing the built-in methods of mass customer, order, and product data available within Magento.

We'll go through how to import externally located files for retrieving and storing information from and to external sources, to mass update or export information with our Magento installation.



This book aims to provide us with a solid foundation of knowledge to develop a site upon by using Magento. The ideas gained by reading this book will enable us to use Magento to build something advanced.

The internal functioning of Magento will be explained in depth, along with extending the present functions. This book will help us in developing our ideas into and onto Magento's default installation.

About the Author

  • Jamie Huskisson

    A passionate 23-year old freelance developer from Nottingham, Jamie Huskisson has been working with Magento for the past two years since the very early Beta versions. His development client list features names such as the NHS, Volkswagen, and Nike building everything from web applications to e-commerce stores and small business sites. He also trains groups of developers and provides consulting on adopting open source technologies over closed systems for clients when required.

    Browse publications by this author
Magento 1.3: PHP Developer's Guide
Unlock this book and the full library for FREE
Start free trial