Magento 1.4 Development Cookbook
Development in Magento
I would have to say that I chose Magento in the first place because it would have a lot of the features we would need available without writing or editing code.
It turns out, that wasn’t so. There will never be a platform you don’t want to tweak, and Magento code may be some of the most complicated PHP code you have seen. It was when I first dug into it.
There were no books at that time and I depended on forum posts to get my answers and I made many mistakes long the way.
I love cookbooks. Telling me how to write the code, documentation or giving me a toy example may help a bit. But a cookbook with real code is something that gives me ideas. And that’s just what the Magento Development Cookbook is.
Finally A Magento Cookbook
Yes, with Magento, you do need at least a VPS. The Magento Development Cookbook starts by walking you from setting up your VPS, setting up Subversion (another important tool), setting up a Magento development project in Netbeans (a great free IDE) to Magento coding conventions and style. The EAV pattern is not a widely known pattern and can leave you at a loss when you are looking for the location of data in the Magento database.
After the first chapter, the first half of the book covers some intermediate level modifications to your Magento store. Not the normal pages of screenshots to fill space. The book goes straight to the meat like a code cookbook should. In 100 pages, the Magento Development Cookbook covers:
Chapter 2: CMS and Design
Introduction
Adding a home link to the menu bar
Changing any page title in Magento
Customizing a Magento error page
Adding AdWords tracking code to order confirmation page in Magento
Adding a custom CMS layout template
Adding an RSS feed (last five tweets!)
Placing the trusty old contact form in CMS
Integrating JW Image Rotator 3.17 in Magento
Chapter 3: Adding Extra Functionalities
Introduction
Integrating WordPress in Magento
Creating a new page
Adding jQuery support
Adding Lightbox2 in Magento
Adding an accepted payment banner at the footer
Chapter 4: Customizing a Store
Introduction
Creating a custom “Twitter handle” field in a registration form
Deleting orders in Magento
Using Google Website Optimizer
Creating a custom variable and using its own e-mail templates
Using Google analytics for Magento
Creating Catalog and Shopping Cart Price Rules
Creating a featured product and showing it in the home page
Creating a custom admin theme
Chapter 5: Playing with Products
Introduction
Setting up the Catalog defaults
Adding a Facebook ‘Like’ button in product page
Setting up Table Rates shipping
Adding a product to the cart through Querystring
Creating a configurable product
Embedding a YouTube video in product details
Chapter 6: Adding a Professional Touch to Your Site
Introduction
Installing Magento 1.4 in PHP 5.3.2 (without mcrypt)
Optimizing Magento store for search engines
Implementing PayPal Website Payments
Pro and Express Checkout into Magento
Preventing a CSRF attack in Magento
Then the next 6 chapters get into the code intensive part of working with Magento. This is where I got stuck for a few months. I had just moved from osCommerce and had just got used to its weird idiosyncrasies and Magento was complexity squared.
Remember I said I chose Magento because I thought there would be less development time because of the extendability. Well, when I was done with Magento, I knew more about code then I eve did before…because I had to. After Magento, I went on to learn a bit of C#, Flash and Python in a few months time because I was no longer scared of any type of code except maybe Java. I guess things work out in weird ways.
And this book will save months of hunting down answers. It covers:
Chapter 7: Database Design
Introduction
Resources and database connections
Magento database replication using Master Slave setup
Using the Magento’s Singleton method
Repairing the Magento database
Working with Magento’s EAV design
Chapter 8: Creating a Module
Introduction
Creating an empty module with a Module Creator
Creating the required directories
Activating a module
Creating a controller for the module
Creating a configuration XML file for the module
Creating a helper for the News module
Creating models for the module
Setting up SQL for the News module
Designing a template for the News module
Adding required blocks for the News module
Chapter 9: Creating a Shipping Module
Introduction
Initializing module configuration
Writing an adapter model
Adding a module in backend
Adding a module in frontend
Chapter 10: Writing a Social Widget
Introduction
Creating an empty module and an enabler file
Creating a config file and declaring the widgets
Writing the default module helper Data.php
Creating a source model for services multi select in widget configuration
Creating frontend block for our widget
Creating templates
Chapter 11: Performance Optimization
Introduction
Measuring/benchmarking your Magento with Siege, ab, Magento profiler,
YSlow, Page Speed, GTmetrix, and WebPagetest
Optimizing Magento database and MySQL configuration
Optimizing Apache web server configuration
Tuning Magento configurations
Using APC/Memcached as the cache backend
Accelerating PHP: php.ini configuration
Applying YSlow and Page Speed rules
Chapter 12: Debugging and Unit Testing
Introduction
Installing and configuring Xdebug
Using FirePHP with Zend Wildfire plugin
Installing PHPUnit and necessary PHP CLI binaries
Writing your first Magento test case
This book will save you a lot of time if your chosen ecommerce platform is Magento. And I don’t blame you. If you have the server power and know how to tweak Magento, it will perform well and look good doing it.
But if you are an average PHP developer or are coming from osCommerce, WordPress or Drupal, your first reaction to Magento might be “who the hell put Java in my PHP” or “did a JAR file explode on my site”. There are thousands of PHP files in a Magento installation. And this book will help with that.

from Stephan Miller