Practical aims, flawed format.,
This review is from: Magento 1.4 Development Cookbook (Paperback)I am making a point not to review the language used in the book however, it is necessary to note that the English language purist, would have a few remarks on the grammar, spelling and overall construction of sentences. The book also employs a jovial and fun writing style which may or may not please readers of technical books. Having said that, the book is still very readable and once the reader becomes used to the writing style, the ability to understand the material is not impaired.
The book is aimed at PHP developers who want to boost their Magento skills. It claims that basic PHP knowledge is necessary but no prior Magento experience. Knowing that Magento is a very complex piece of software, this statement was somewhat surprising to me and indicated a promise that, I'd say, is not so easy to keep.
The material covered in the book stretches over a wide variety of topics oriented towards but not exclusively limited to developing with Magento. In the first chapter we learn how to set up a development environment using svn, a LAMPP (XAMPP) stack and Netbeans for the development IDE. Then we get an overview of working with some Magento design and CMS features such as customizing the error page and adding an RSS feed to your site. Chapter 3 goes into adding extra functionality to your Magento site by integrating WordPress, adding a Lightbox and jQuery (!). Covered next are topics on customizing a store, addressing working with the product catalog and adding a professional touch to your site. Then we get a quick glance at working with the Magento database directly. Chapter 8 is solely devoted to creating a Magento module (or extensions) from scratch, followed by more chapters on adding functionality to Magento via modules and widgets. The final two chapters discuss the performance optimization and debugging and unit testing techniques.
As we can see, the topics are quite ambitious for the just over 250 pages.
It is important to bear in mind that this is a `recipe' book which means that due to the very nature of the format, the individual recipes are small, short and self contained pieces of functionality that, in theory, could be applied immediately to solve a certain problem. This, in turn, means that the author doesn't have the luxury of delving deeper into the topic at hand which has the effect of leaving readers wanting for more clarity and explanation in some chapters.
Personally, I would argue that the `recipe' book format may not be the most suitable for writing about complex topics such as Magento, especially if the goal is to advance one's in-depth knowledge and learn more advanced aspects of developing with Magento. While we end up with useful snippets of core or steps for performing certain tasks, we never quite get enough background information in order to fully understand why things work. Granted, the Author tries to add value under the "How it Works" parts of each recipe but, again, the format constraint doesn't allow for lengthy elaborations.
Be that as it may, let's see in more detail, what we can learn and apply by working through this book.
The book is supposed to cover Magento 1.4 development, however, while reading it, I couldn't escape the feeling that parts were written with Magento 1.3.x in mind and possibly later adapted for 1.4. Magento 1.4 changed a few things from 1.3.x, notably the way that the design themes are handled but the book still uses the Magento 1.3.x paradigm of adding extension designs to the default/default theme as opposed to the base/default.
Each recipe starts with the title of the recipe, an optional "Getting ready" paragraph outlining the prerequisits for the recipe, the "How to do it..." part containing the steps, actions and code for the execution of the recipe and the "How it works" part, where the recipe is explained. Sometimes a certain topic will be covered over several recipes where subsequent recipes build upon covered material.
So let's see what each chapter has to offer.
A lot of development books will start with tips on how to set up an environment for development. Here we learn how to set up our local development server with Apache, MySQL and PHP and create our local development site via an Apache virtual host entry. We then set up the subversion (svn) client and check out the latest Magento version form the Magento svn repository. The author shows us how to set up some MySQL GUI tools and create the Magento database. Subsequently, he shows us how to set up our development environment using the Netbeans IDE and finally explains the relevant directories in a default Magento installation.
The topics covered here are straightforward development procedures that are well known to practicing developers and can comfortably be skipped. One note I have is that it would have been nice to state the alternative way of installing Magento using the official download as well as an alternative to using svn. Personally, I prefer using git for all my Magento projects and don't bother with checking out Magento code via svn. The svn approach may be more relevant in the case of wanting to keep up to date with the very latest bleeding edge Magento development for research and testing purposes.
In this chapter we are immediately plunged into editing some theme phtml files. Curiously, here, we can see that the author is aware of the app/design/frontend/base structure of Magento 1.4 but later in the book we have references to the older style of Magento 1.3.x. Also, we seem to be encouraged to edit the template files directly. It would have been good to first outline the procedure of setting up your own design package and theme and use that as the basis of all customizations.
Nevertheless, we learn how to add a home page link to the default navigation, alter the document title, customize the 404 page, add adwords tracking to the order confirmation page, add a custom CMS layout template, add an RSS feed displaying the last 5 tweets from a Twitter account. We also learn how to place the built in contact form into a CMS page and integrate the Flash based JW Image Rotator on the home page.
Logically, some of the recipes are already in the territory of modules but those are covered much later in the book. At this point, we have to accept this and trust the author. No doubt that some of the recipes here will be useful to beginners starting out with Magento, but there is little new ground covered for someone who has already worked with Magento.
This chapter promises more excitement starting with a recipe on how to integrate WordPress into Magento. After that we see how to add a new CMS page in the Magento admin, add jQuery support and a 3D rotating tag cloud and integrate the Lightbox 2 in our product pages. Finally, we edit the site footer template and insert a block of accepted payment method images.
Once again, practical recipes achieving several useful goals, but...
For me, the WordPress recipe is too simplistic. It simply shows how to install WordPress and theme it so it matches your Magento theme and that's it. There are several other methods of integrating WordPress but none have been mentioned.
I also have a problem with the jQuery recipe. As the author himself says, Magento already comes with the Prototype and Scriptaculous JS frameworks so why add more weight to the site by installing jQuery? Understandably, jQuery has more fantastic plugins and performs better but ultimately I would avoid adding a whole new JS library to a Magento store if page load and rendering performance is important. A warning or note around that would have been sufficient.
This chapter is titled "Customizing a Store". It is a mix of admin user guide showing us how to use the built in Google Optimizer features, create custom variables for use in email templates, enable Google Analytics and create catalog and shopping cart price rules for your promotional activity. The other recipes will teach how to delete orders, create a featured product and a custom admin theme.
Mostly novice material but it was useful to see how to quickly create featured products and a custom admin theme if you want to alter the admin branding for your clients. I had an issue with the deleting orders recipe (by installing a free extension from Magento connect) as this functionality is omitted from Magento on purpose but it was referring to deleting orders performed while testing the store under development. I would not recommend leaving this extension accessible to a store owner when the store goes live.
is called `Playing with Products' and, again for the most part, is a guide to the Magento admin back end surrounding the catalog and products. We are shown how to set up the catalog configuration, load shipping rates for the Table Rate shipping method, create a configurable product and insert a YouTube video in the product description field. The other recipes cover adding a Facebook `Like' button on the product page and adding a product to the cart via using a URL query string.
This chapter feels like it's definitely targeted towards the Magento novice and there is not much to learn if you already have some Magento experience under your belt.
Entitled "Adding a Professional Touch to your Site" I can't see what that has to do with installing Magento on PHP 5.3.2 where mcrypt is not available. Also, the other recipes just tell us how to set up some admin configuration values in order to optimize the store for SEO and enable PayPal. All these are user manual material.
Finally, in this chapter we start learning something we may not have known before. We are shown how to use Magento's database resources for querying the database directly and even learn how to set up a master-slave configuration that could help us with performance and load balancing later down the track. Another recipe teaches us how to perform product lookups based on certain attribute values.
Pretty advanced stuff is covered here and reading this chapter is a big surprise compared to the previous material. Good knowledge of the Magento internals is required to understand the subject matter.
The excitement continues in chapter 8 where, through a series of related and dependent recipes, we are shown how to create a full Magento module or extension as it's called on Magento Connect.
The example is to create a "News" module and covers both interaction with the admin back end where the module has a separate menu item and maintenance interface as well as the front end display of the data entered for the News section. In my opinion, the best chapter in this book as far as learning Magento goes. Still, it's geared towards achieving the goal as quickly as possible and may leave the reader with a lot more questions at the end but this may be more something to do with the recipe format constraint I mentioned earlier.
I also downloaded the code for the book and tried installing the code for this chapter in my local Magento 1.4.2 test site. Initially, the code didn't work, bringing up a blank page when entering the back end News menu. I discovered that there were a couple of errors in NewsController.php on and around line 25 as well as the fact that the front end templates were not put into the correct package and theme folders. I had to move the layout and template folders manually from frontend/default/layout and .../template to frontend/base/default/. After that, the extension did work as described in the series of recipes.
This chapter goes through quick steps of creating a shipping module but doesn't elaborate much. The code for this chapter didn't work on my Magento 1.4.2 install and I didn't delve into working out why. If you need to create your own shipping module, it's probably better just to look at how one of the built in shipping methods is coded and go from there. Also, this area seems to change often between Magento versions so information may become outdated quickly.
One of the new features in Magento 1.4 is the ability to use and create widgets for inserting into CMS pages and static blocks. This chapter exactly explains how to create a social widget. Another useful set of recipes and we end up with a usable widget as the code supplied worked well on my test site.
This chapter deals with performance optimization and give us recipes on how to measure our site performance using a variety of benchmarking tools such as Siege, Apache Bench, the built in Magento profiler and browser based tools like YSlow and Page Speed. Furthermore, it gives us tweaks for the MySQL and Apache configuration as well as tuning the Magento configuration. It shows how to add APC and Memcached and configure Magento to use those.
All in all a very useful chapter and while a lot of this information is available online and on the Magento Wiki, it is good to have a concise reference in one place.
Covers installing XDebug and using FirePHP with Zend Wildfire as well as installing PHPUnit and creating a simple unit test for the News module described earlier in the book.
This chapter feels useful but needs a bit more expansion on the topics as it gives us the bare basics. Debugging and unit testing is a complex area and cannot easily be addressed by a few recipes. Nevertheless, credit to the author for including these challenging topics and giving a starting point to the reader.
I have mixed feelings about this book. Parts of it seem too simplistic and basic and feel like a user manual explaining how to configure the Magento back-end, while other parts delve into complex topics and attempt to cover subjects that may be outside of the target of the book. In the end, the recipe format falls short of being the right vehicle for conveying in depth understanding of Magento. On the other hand, if you want a handy set of short recipes that solve some of your immediate problems, then this book can provide quick solutions.
Ultimately, if you are a novice Magento developer and want to explore and understand Magento beyond the "quick and easy" you'll have to look elsewhere. Also, I wouldn't take some of the approaches to customizing Magento that are outlined in the book as "gospel" since they are designed to achieve a goal quickly, with the least amount of steps. This is not an approach to get used to since there is always the easy way and the right way for implementing Magento customizations.
My final conclusion is that this book would be useful for Magento novices and hobbyists who want to tinker with their shop, apply some basic customizations, and have a handy reference for implementing some performance boosting techniques. There is little new material for the intermediate Magento developer and if you are looking for in depth understanding of Magento internals and advanced customization techniques, then we are yet to see a book that offers that in today's tech book scene.
My 3 stars are really between 2 and 3.
I'd also recommend Packt Publishing to employ a more effective review process to weed out typo's and other language and consistency errors.