Book Image

Magento PHP Developer's Guide

By : Allan MacGregor
Book Image

Magento PHP Developer's Guide

By: Allan MacGregor

Overview of this book

<p>Magento has completely reshaped the face of e-commerce since its launch in 2008. Its revolutionary focus on object oriented and EAV design patterns has allowed it to become the preferred tool for developers and retailers alike.</p> <p>"Magento PHP Developer’s Guide" is a complete reference to Magento, allowing developers to understand its fundamental concepts, and get them developing and testing Magento code.</p> <p>The book starts by building the reader’s knowledge of Magento, providing them with the information, techniques, and tools that they require to start their first Magento development.</p> <p>After building this knowledge, the book will then look at more advanced topics: how to test your code, how to extend the frontend and backend, and deploying and distributing custom modules.</p> <p>"Magento PHP Developer’s Guide" will help you navigate your way around your first Magento developments, helping you to avoid all of the most common headaches new developers face when first getting started.</p>
Table of Contents (16 chapters)
Magento PHP Developer's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The Magento PHP Developer's Guide will help new and not so new developers to understand and work with Magento's fundamental concepts and standard practices for developing and testing code in Magento.

This book is my attempt to write a guide that answers questions that many developers, including myself, had when we started to develop for Magento: What is EAV? How does the ORM in Magento work? What are observers and events? Which design patterns were used to create Magento?

Most importantly, this book also answers questions that many developer still have to this day: What is the standard for developing modules and extending the frontend and backend? How can I properly test my code? What is the best method to deploy and distribute custom modules?

What this book covers

Chapter 1, Understanding and Setting Up Our Development Environment, will help you set up a complete environment for Magento development with MySQL and Apache. Additionally, we will go over the tools available to facilitate the development, several IDEs, and version control systems.

Chapter 2, Magento Fundamentals for Developers, will be about the fundamental concepts of Magento, such as the system architecture, MVC implementation, and its relation with Zend Framework. All the concepts in this chapter will set the foundation for developers starting with Magento.

Chapter 3, ORM and Data Collections, covers collections and models in Magento that are the bread and butter of everyday Magento development. In this chapter, we will introduce the reader to the Magento ORM system, and we will learn how to properly work with data collections and the EAV system.

Chapter 4, Frontend Development, will explain the practical use of the skills and knowledge we have acquired so far, and we'll be building a fully functional Magento Module step by step. The custom module will allow readers to apply a variety of important concepts, such as working with collections, routing, sessions, and caching.

Chapter 5, Backend Development, will extend what we built in the previous chapter and create an interface in the Magento backend for interacting with our application data. We will learn about extending the backend, the admin HTML theme, setting data sources, and controlling our extension behavior through configuration.

Chapter 6, The Magento API, will explain the Magento API and how we can extend it for providing access to the custom data that we captured using our extension.

Chapter 7, Testing and Quality Assurance, will help the reader learn critical skills for testing our Magento modules and custom, which form an integral part of development. We will learn about the different types of tests and the tools available for each particular type of test.

Chapter 8, Deployment and Distribution, will help the reader learn about the multiple tools available for deploying our code to a production environment and how to properly pack our extensions for distribution through channels such as Magento Connect.

Appendix, Hello Magento, will give new developers a quick and easy to follow introduction for creating our first Magento Extension.

What you need for this book

You will need an installation of Magento 1.7, either on a local machine or on a remote server, your favorite code editor, and permissions to install and modify files.

Who this book is for

If you are a PHP developer getting started with Magento or if you already have some experience with Magento and want to understand the Magento architecture and how to extend the frontend and backend of Magento, this is the book for you!

You are expected to be confident with PHP5. No experience with Magento Development is expected, although you should be familiar with basic Magento operations and concepts.

Conventions

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: "GitHub now includes a .gitignore file specifically for Magento, which will ignore all the files in the Magento core and only keep track of our own code."

A block of code is set as follows:

{
    "id": "default",
    "host": "magento.localhost.com",
    "repo": [
        "url": "svn.magentocommerce.com/source/branches/1.7",

Any command-line input or output is written as follows:

$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
$ vagrant init lucid32
$ vagrant up

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 should now see Apache's default web page with the message It Works!".

Note

Warnings or important notes appear in a box like this.

Tip

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 www.packtpub.com/authors.

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 http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

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 http://www.packtpub.com/submit-errata, 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 http://www.packtpub.com/support.

Piracy

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.

Questions

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.